@@ -42,8 +42,6 @@ import {
4242 getExtension
4343} from "../../utils/sources-tree" ;
4444
45- import { getRawSourceURL } from "../../utils/source" ;
46-
4745import { copyToTheClipboard } from "../../utils/clipboard" ;
4846import { features } from "../../utils/prefs" ;
4947
@@ -94,7 +92,13 @@ class SourcesTree extends Component<Props, State> {
9492 }
9593
9694 componentWillReceiveProps ( nextProps ) {
97- const { projectRoot , debuggeeUrl , sources , shownSource } = this . props ;
95+ const {
96+ projectRoot ,
97+ debuggeeUrl ,
98+ sources ,
99+ shownSource ,
100+ selectedSource
101+ } = this . props ;
98102
99103 const { uncollapsedTree, sourceTree } = this . state ;
100104
@@ -123,16 +127,16 @@ class SourcesTree extends Component<Props, State> {
123127 return this . setState ( { listItems } ) ;
124128 }
125129
126- if ( nextProps . selectedSource ) {
127- const highlightUrl = nextProps . selectedSource . get ( "url" ) ;
130+ if (
131+ nextProps . selectedSource &&
132+ nextProps . selectedSource != selectedSource
133+ ) {
134+ const highlightItems = getDirectories (
135+ nextProps . selectedSource . get ( "url" ) ,
136+ sourceTree
137+ ) ;
128138
129- if ( highlightUrl ) {
130- const highlightItems = getDirectories (
131- getRawSourceURL ( highlightUrl ) ,
132- sourceTree
133- ) ;
134- return this . setState ( { highlightItems } ) ;
135- }
139+ return this . setState ( { highlightItems } ) ;
136140 }
137141
138142 // NOTE: do not run this every time a source is clicked,
0 commit comments