Conversation
| // Update sessionStorage with the new state | ||
| if (typeof sessionStorage !== 'undefined') { | ||
| if (!isEmptyQueryState(state)) sessionStorage.setItem(sessionQueryKey, JSON.stringify(state)); | ||
| else sessionStorage.removeItem(sessionQueryKey); |
There was a problem hiding this comment.
Im a bit confused by this line, when would we want to remove the old sessionQuery is the current query state is empty?
There was a problem hiding this comment.
this also means that if I click on a sequence after going back to a search page the restore state disappears, I probably would opt to not remove the state, but maybe I am missing sth
There was a problem hiding this comment.
Yeah this is not ideal behaviour, I will have a further look at this. It should really only be affected by changing the filters
anna-parker
left a comment
There was a problem hiding this comment.
I think this is a great improvement! But think we should wait on feedback from @theosanderson and @chaoran-chen before merging :-)
|
I suggested in Slack that we discuss in an upcoming meeting – lots of different ideas floating around and I think useful to talk through |
This PR adds a 'Restore previous search' button, using the user's browser
sessionStorage. If a user navigates to an organism's search page, does anything to alter the search page's state (add filters/columns, pagination, sorting etc.), navigates away to another organism or page, and comes back, they will now recieve a prompt to restore the last state on that page:The search page state is tracked and stored in session storage separately for each organism. If the user goes to a previously visited organism, gets the 'restore previous search' button, but chooses to do something else (e.g. add a different search field) then the 'restore previous search' button disappears.
Any feedback on the usability of this is welcome!
PR Checklist
🚀 Preview: https://restore-previous-search.loculus.org