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

Keep existing selection after reindexing #336

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

winstliu
Copy link
Contributor

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

After a reindex completes, all the items in the select list get regenerated. If someone had a file selected, the refresh would cause the selection to jump back to the first element. This PR fixes that by manually re-selecting the previous file after the reindex completes.

Alternate Designs

I hope there's an alternate design; this one didn't come out that pretty.

Benefits

Selection will not unexpectedly change after a reindex completes.

Possible Drawbacks

The for loop I added creates some delay, especially for larger projects since it loops through every single file.

Applicable Issues

Fixes #210

/cc @Ben3eeE

@Ben3eeE
Copy link

Ben3eeE commented Mar 5, 2018

@50Wliu Thanks for opening this ⚡️ LGTM. I couldn't notice any delay even with a larger project and slow computer where I noticed the issue this fixes!

🚢 if you are fine with the drawback!

@nfarina
Copy link

nfarina commented Aug 8, 2018

This issue has been driving me crazy - would love to have this fixed! Any reason it can't be merged? Seems like a slam dunk—straightforward code and small scope of changes.

@winstliu
Copy link
Contributor Author

winstliu commented Aug 9, 2018

Forgot about this PR. Let me revisit it in the next few days and see if I can remember my logic here.

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

Successfully merging this pull request may close these issues.

Jump to first item after reindexing
3 participants