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): select top dataset when suggest was triggered manually #1440

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

ivan-aksamentov
Copy link
Member

@ivan-aksamentov ivan-aksamentov commented Apr 19, 2024

This changes behavior of dataset suggestions: now when use clicks "Suggest" button on main page, if suggestion run completes successfully, then top matching dataset is selected as current dataset automatically. This does not happen after automatic suggestion runs.

When use clicks "Suggest" button on main page, if suggestion run completes successfully, then top matching dataset is selected as current dataset automatically.

This does not happen after implicit suggestion runs.
Copy link

vercel bot commented Apr 19, 2024

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

Name Status Preview Updated (UTC)
nextclade ✅ Ready (Inspect) Visit Preview Apr 19, 2024 8:09pm

@ivan-aksamentov
Copy link
Member Author

ivan-aksamentov commented Apr 19, 2024

Currently broken: automatic selection only happens after second click when autosuggest toggle is disabled.

Let's focus on the `getPromise()` calls followed by the `set(datasetCurrentAtom, ...)` call. This combo lags behind and does not yet receive the suggestion results we've just `set()` in the `onResult()` callback. With this config the "Suggest" button needs to be clicked twice for autoselection to take effect. And with current (quite complex) code organization I don't see any more obvious way to set the top dataset.

Let's use an additional boolean state which tells that the suggestion was triggered manually. We can then use it in the caller component, which would set. This guarantees ordering of operations and correct selection of the top dataset.

Technically, this boolean flag does not need to be retained. I hope it does not cause unwanted side effects across runs.
@ivan-aksamentov ivan-aksamentov marked this pull request as ready for review April 19, 2024 20:47
@ivan-aksamentov ivan-aksamentov merged commit b3c410d into master Apr 23, 2024
20 checks passed
@ivan-aksamentov ivan-aksamentov deleted the feat/web-select-dataset-when-trigger-manual branch April 23, 2024 01:42
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