Skip to content

feat(website): restore previous search button#6147

Draft
tombch wants to merge 8 commits intomainfrom
restore-previous-search
Draft

feat(website): restore previous search button#6147
tombch wants to merge 8 commits intomainfrom
restore-previous-search

Conversation

@tombch
Copy link
Collaborator

@tombch tombch commented Mar 16, 2026

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:

image

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

  • All necessary documentation has been adapted.
  • The implemented feature is covered by appropriate, automated tests.
  • Any manual testing that has been done is documented (i.e. what exactly was tested?)

🚀 Preview: https://restore-previous-search.loculus.org

@claude claude bot added the website Tasks related to the web application label Mar 16, 2026
@tombch tombch added preview Triggers a deployment to argocd website Tasks related to the web application and removed website Tasks related to the web application labels Mar 16, 2026
// Update sessionStorage with the new state
if (typeof sessionStorage !== 'undefined') {
if (!isEmptyQueryState(state)) sessionStorage.setItem(sessionQueryKey, JSON.stringify(state));
else sessionStorage.removeItem(sessionQueryKey);
Copy link
Contributor

Choose a reason for hiding this comment

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

Im a bit confused by this line, when would we want to remove the old sessionQuery is the current query state is empty?

Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this is not ideal behaviour, I will have a further look at this. It should really only be affected by changing the filters

Copy link
Contributor

@anna-parker anna-parker left a comment

Choose a reason for hiding this comment

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

I think this is a great improvement! But think we should wait on feedback from @theosanderson and @chaoran-chen before merging :-)

@theosanderson
Copy link
Member

I suggested in Slack that we discuss in an upcoming meeting – lots of different ideas floating around and I think useful to talk through

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

Labels

preview Triggers a deployment to argocd website Tasks related to the web application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants