Skip to content
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

feat(web): sort & run #1562

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft

feat(web): sort & run #1562

wants to merge 17 commits into from

Conversation

ivan-aksamentov
Copy link
Member

No description provided.

Copy link

vercel bot commented Jan 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nextclade ✅ Ready (Inspect) Visit Preview Feb 4, 2025 2:27am

This modifies many state atoms into atom families parameterized by the currently viewed datasets. This prepares the app to allow to run analysis on multiple datasets at the same time and to switch between multiple datasets when browsing the results of such run.
This triggered a webpack warning and was caused by the import of `findDatasetNameBySeqNameStrings` from a module from main bunle into the webworker file.
I initialize the datasets atom (containing all fetched datasets once they are fetched) initially to an empty array to avoid triggering infinite `<Suspense/>`
We may or may not change this list later, but for now lets assume all suggested datasets need to be initialized and be able to run
Unrelated change, but it's a quick improvement.
Even though types are duplicated, TypeScript allows this as long as the types are structurally the same, which was easy to adjust. This way we don't need a cast.
Here I split the analysis results before passing them to the tree placement.

Because analyses are specific to a dataset they were analyzed with, they are only compatible with the tree coming from the same dataset.
Th map needed a copy. Let's also improve checking of the nil values as well as make key names consistent with the corresponding storage atom.
This required a little bit more processing of suggestion results. We need different maps : from sequence index to dataset name (smaller; to pass to webworkers), from sequence index to full dataset object (larger; to use locally), and vice versa.

The `processSuggestionResults()` has grown a bit too big and might need to be refactored and split into smaller functions (or react hooks or recoil selectors)
Auspice state is global and is stored in Redux. From Nextclade we don't have access to how state is stored and operated on.

But we need to switch what Auspice is rendeing when viewed dataset is changed.

Instead of recomputing the state on every switch, I decided to try and precompute what's the necessary state in the webworker, as before but for each of the multiple datasets now. Then I dump the entire auspice state in recoil atom family (by dataset name). When a dataset is selected on tree page, I can now quickly restore the redux state from saved state.

This way we can hopefully quickly switch what Auspice is rendering.
This is dangerous because the state for one dataset may be invalid for another dataset.

Here I create a memoized Map of auspice tree components by dataset name - this way the auspice component instances are different components.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant