nextclade
nextclade copied to clipboard
Nextclade Web: don't store unnecessary dataset info in local storage
Back in the day, when datasets description objects were very small, I decided (lazily) to store in the local storage the dataset object as-is, as it comes from the index.json. The "current dataset" Recoil state atom and local storage is neatly synchronized using Recoil plugin.
Time flies by and new features were added, like custom dataset servers, single datasets without servers and since https://github.com/nextstrain/nextclade/pull/1455 also Auspice-based datasets.
The dataset description has grown in size. When switching dataset servers you now can receive errors, because new server might not have the dataset the old server had and local storage preserves the old dataset (e.g. its name).
This has aggravated with https://github.com/nextstrain/nextclade/pull/1455, when I decided to also store the whole Auspice JSON in the dataset description. Very convenient, not very responsible! Trees might reach up to around 50-100MB in size and local storage sometimes refuses to update (with corresponding errors in the console).
Long story short, this needs to change. Only minimal information should be retained and when external conditions change, the local storage should be discarded.
We need to enumerate all possibilities for different input types and handle them correctly.