Skip to content

Commit 4fc2923

Browse files
darkwingjasonLaster
authored andcommitted
Ensure the source tree highlights the correct item, regardless of pretty or original print (firefox-devtools#5455)
1 parent 6f985bc commit 4fc2923

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/components/PrimaryPanes/SourcesTree.js

+12-16
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import {
4242
getExtension
4343
} from "../../utils/sources-tree";
4444

45+
import { getRawSourceURL } from "../../utils/source";
46+
4547
import { copyToTheClipboard } from "../../utils/clipboard";
4648
import { features } from "../../utils/prefs";
4749

@@ -92,13 +94,7 @@ class SourcesTree extends Component<Props, State> {
9294
}
9395

9496
componentWillReceiveProps(nextProps) {
95-
const {
96-
projectRoot,
97-
debuggeeUrl,
98-
sources,
99-
shownSource,
100-
selectedSource
101-
} = this.props;
97+
const { projectRoot, debuggeeUrl, sources, shownSource } = this.props;
10298

10399
const { uncollapsedTree, sourceTree } = this.state;
104100

@@ -127,16 +123,16 @@ class SourcesTree extends Component<Props, State> {
127123
return this.setState({ listItems });
128124
}
129125

130-
if (
131-
nextProps.selectedSource &&
132-
nextProps.selectedSource != selectedSource
133-
) {
134-
const highlightItems = getDirectories(
135-
nextProps.selectedSource.get("url"),
136-
sourceTree
137-
);
126+
if (nextProps.selectedSource) {
127+
const highlightUrl = nextProps.selectedSource.get("url");
138128

139-
return this.setState({ highlightItems });
129+
if (highlightUrl) {
130+
const highlightItems = getDirectories(
131+
getRawSourceURL(highlightUrl),
132+
sourceTree
133+
);
134+
return this.setState({ highlightItems });
135+
}
140136
}
141137

142138
// NOTE: do not run this every time a source is clicked,

0 commit comments

Comments
 (0)