From 2769d9cca63c7fc6d48badaa97011d903be2e2dc Mon Sep 17 00:00:00 2001 From: ivan-aksamentov Date: Wed, 10 Jul 2024 12:06:26 +0200 Subject: [PATCH 1/3] fix: panic in map lookup We can ignore unknown categories here. We check correctness of this input elsewhere. --- packages/nextclade/src/io/nextclade_csv.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/nextclade/src/io/nextclade_csv.rs b/packages/nextclade/src/io/nextclade_csv.rs index f52b8e916..d271e2c34 100644 --- a/packages/nextclade/src/io/nextclade_csv.rs +++ b/packages/nextclade/src/io/nextclade_csv.rs @@ -108,10 +108,9 @@ impl CsvColumnConfig { let categories = categories .into_iter() - .filter(|category| !matches!(category, CsvColumnCategory::Dynamic)) // Dynamic columns are handled specially - .map(|category| { - let columns = CSV_COLUMN_CONFIG_MAP_DEFAULT.get(&category).unwrap().clone(); - (category, columns) + .filter_map(|category| { + let columns = CSV_COLUMN_CONFIG_MAP_DEFAULT.get(&category)?.clone(); + Some((category, columns)) }) .collect(); From f6dbc8c007d7003bc854a6c88222e161a9549a5e Mon Sep 17 00:00:00 2001 From: ivan-aksamentov Date: Wed, 10 Jul 2024 12:06:52 +0200 Subject: [PATCH 2/3] fix: off-by-one in map insertion --- packages/nextclade/src/io/nextclade_csv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextclade/src/io/nextclade_csv.rs b/packages/nextclade/src/io/nextclade_csv.rs index d271e2c34..4d536d9e4 100644 --- a/packages/nextclade/src/io/nextclade_csv.rs +++ b/packages/nextclade/src/io/nextclade_csv.rs @@ -355,7 +355,7 @@ fn rel_mut_cols(desc: &AuspiceRefNodeSearchDesc) -> [String; 5] { } fn insert_after(v: &mut Vec, index: usize, val: T) { - if index > v.len() { + if index >= v.len() { v.push(val); } else { v.insert(index + 1, val); From 36c474f3252daa5e6208d184a011daafcf7663b9 Mon Sep 17 00:00:00 2001 From: ivan-aksamentov Date: Wed, 10 Jul 2024 12:11:26 +0200 Subject: [PATCH 3/3] fix(web): wipe local storage on user machines This allows to erase current CSV/TSV column config settings, such that the default set of columns is selected. This is done to enable new column categories released in Nextclade 3.8.0. --- packages/nextclade-web/src/state/persist/localStorage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextclade-web/src/state/persist/localStorage.ts b/packages/nextclade-web/src/state/persist/localStorage.ts index dc9142d4a..02555102f 100644 --- a/packages/nextclade-web/src/state/persist/localStorage.ts +++ b/packages/nextclade-web/src/state/persist/localStorage.ts @@ -2,5 +2,5 @@ import { recoilPersist } from 'recoil-persist' import { PROJECT_NAME } from 'src/constants' export const { persistAtom } = recoilPersist({ - key: `${PROJECT_NAME}-storage-v4`, // increment this version on breaking changes + key: `${PROJECT_NAME}-storage-v5`, // increment this version on breaking changes })