File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/projects/detail/containers Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,18 @@ class SingleFeedContainer extends React.Component {
4545 }
4646
4747 componentDidMount ( ) {
48- // we use this to just scroll to a feed block or comment in a feed block, if there is a url hash
48+ // we use this to just scroll to a feed block or comment in a feed block,
49+ // only if there is a url hash and the feed id and comment id match this feed
4950 const scrollTo = window . location . hash ? window . location . hash . substring ( 1 ) : null
5051 if ( scrollTo ) {
51- setTimeout ( ( ) => scrollToHash ( scrollTo ) , 100 )
52+ const hashParts = _ . split ( scrollTo , '-' )
53+ const hashId = parseInt ( hashParts [ 1 ] , 10 )
54+ if (
55+ ( hashParts [ 0 ] === 'feed' && hashId === this . props . id ) ||
56+ ( hashParts [ 0 ] === 'comment' && this . props . comments && _ . some ( this . props . comments , { id : hashId } ) )
57+ ) {
58+ setTimeout ( ( ) => scrollToHash ( scrollTo ) , 100 )
59+ }
5260 }
5361 }
5462
You can’t perform that action at this time.
0 commit comments