Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Scroll to selected diff line only if head of selection changes #1281

Merged
merged 1 commit into from
Jan 13, 2018

Conversation

kuychaco
Copy link
Contributor

Previously, componentDidUpdate was being called when anonymous
function props were updated, triggering scrolling at undesired times.
Instead, now we specifically check to see if the relevant props have
changed before scrolling.

Fixes #1226
Fixes #884

Previously, `componentDidUpdate` was being called when anonymous
function props were updated, triggering scrolling at undesired times.
Instead, now we specifically check to see if the relevant props have
changed before scrolling.

Admittedly, I'm not sure what the purpose of the `selectedLine` branch
of the original conditional was for. I traced its addition back to the
"open diff from editor" feature I added 8 months ago, but manual testing
of that feature seems to work without it. So I'm removing it and hoping
that no regression is introduced, and taking a mental note to write more
informative commit messages in the future.
@kuychaco kuychaco requested a review from BinaryMuse January 12, 2018 23:51
Copy link
Contributor

@BinaryMuse BinaryMuse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good other than one question: we dropped the setTimeout — I assume it's not necessary anymore?

@kuychaco
Copy link
Contributor Author

we dropped the setTimeout — I assume it's not necessary anymore?

Yeah we've dropped that branch of the conditional entirely. Tbh it's still unclear why we needed it in the first place. And the conditional branch that uses it seems to be for the "Open diff from editor" feature, but removing it doesn't seem to break anything because the hunkLine branch handles the case. So I just dropped that logic entirely as it seems redundant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants