New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep collapsed items in sync with search results #1000

Merged
merged 1 commit into from Apr 9, 2018

Conversation

Projects
None yet
3 participants
@Lassi
Contributor

Lassi commented Mar 12, 2018

Description of the Change

When searching across projects, if some items are collapsed in the search results view and new results are added, the collapsed items do not stay in sync with the results. Instead, collapsed items are "sliding" up and down as results are added/removed. This is due to the collapsed state being represented by an array of booleans that does not get updated when search results change. This commit introduces a fix to that issue by making sure that we update the aforementioned array as needed.

Alternate Designs

An alternative to this design would have been to store the collapsed state directly on the element representing a "matched file" but it would entail a pretty big refactoring of the code which I don't feel I am familiar enough to start modifying in such length.

Benefits

Whenever search results are updated, if some results were collapsed, these results will stay collapsed as expected. Previously, this "collapsed state" would be transferred to the search result above/below a collapsed item depending of the index where a search result would get inserted/removed.

Possible Drawbacks

This might introduce some performance issues on very big sets of results as the array representing the collapsed items gets updated every time search results get updated.

Applicable Issues

#916

Keep collapsed items in sync with search results
When searching across projects, if some items are collapsed in the
search results view and new results are added, the collapsed items
do not stay in sync with the results. Instead, collapsed items are
"sliding" up and down as results are added/removed. This is due to
the collapsed state being represented by an array of booleans that
does not get updated when search results change. This commit
introduces a fix to that issue by making sure that we update the
aforementioned array as needed.

Fixes #916
@PoignardAzur

This comment has been minimized.

Contributor

PoignardAzur commented Mar 14, 2018

Damn, I was working on the same thing. (except my approach is the "refactor" one)

@jasonrudolph

This comment has been minimized.

Member

jasonrudolph commented Apr 9, 2018

Thanks for this fix, @Lassi. 🙇

@jasonrudolph jasonrudolph merged commit 1a77e3a into atom:master Apr 9, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Lassi Lassi deleted the Lassi:fix/preserve-collapsed-state-on-search-updates branch Aug 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment