#9780 - Save the polymer type switcher (RNA/DNA/PEP) to browser cache#10148
Open
mariam-khutuashvili wants to merge 2 commits into
Open
#9780 - Save the polymer type switcher (RNA/DNA/PEP) to browser cache#10148mariam-khutuashvili wants to merge 2 commits into
mariam-khutuashvili wants to merge 2 commits into
Conversation
Persist the selected polymer type to localStorage whenever it changes (switcher click or Ctrl+Alt+R/D/P) and restore it when Macromolecules mode opens, defaulting to RNA when nothing is cached. The restored type also drives the default monomer-library tab.
Contributor
Review summarySmall, focused change with a clean helper and good test coverage of the validation path. A few things worth addressing before merge — all noted as inline comments:
Security review found nothing of concern (strict enum equality on the deserialized value, no DOM/HTML/navigation sink). No public-API or changelog doc updates are missing — the analogous |
…leaked handler - Guard getPersistedSequenceType against malformed JSON (JSON.parse can throw); log via KetcherLogger and fall back to RNA, with a test. - Reword comment 'browser cache' -> 'localStorage' to match the codebase. - Lift the changeSequenceTypeEnterMode handler to a named const and remove it in the effect cleanup so it no longer leaks on re-run/StrictMode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How the feature works? / How did you fix the issue?
(Screenshots, videos, or GIFs, if applicable)
Description
The Macromolecules polymer-type switcher (RNA / DNA / PEP) now remembers the last-selected type in the browser
cache (localStorage) and restores it when Macromolecules mode is opened, instead of always resetting to RNA.
Defaults to RNA when nothing is stored.
Requirements covered
Ctrl+Alt+R/D/P hotkeys (both funnel through the single changeSequenceTypeEnterMode event).
where the switcher is not visible — the switcher component is always mounted, so the restore-on-open dispatch
flows through the existing type→tab mapping.
Changes
falls back to RNA) and persistSequenceType(), following the existing localStorageWrapper convention.
RNA.
RNA.
Check list
#1234 – issue name