Skip to content

Commit

Permalink
Merge pull request #1453 from nextstrain/fix/current-dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-aksamentov authored May 14, 2024
2 parents e074267 + 29b8a35 commit 4bfe065
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/nextclade-web/src/state/dataset.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { autodetectResultsAtom } from 'src/state/autodetect.state'
import type { Dataset, MinimizerIndexVersion } from 'src/types'
import { persistAtom } from 'src/state/persist/localStorage'
import { isDefaultValue } from 'src/state/utils/isDefaultValue'
import { areDatasetsEqual } from 'src/types'

export interface Datasets {
datasets: Dataset[]
Expand All @@ -29,11 +28,11 @@ export const datasetCurrentAtom = selector<Dataset | undefined>({
get({ get }) {
return get(datasetCurrentStorageAtom)
},
set({ get, set, reset }, dataset: Dataset | undefined | DefaultValue) {
set({ set, reset }, dataset: Dataset | undefined | DefaultValue) {
if (isDefaultValue(dataset) || isNil(dataset)) {
reset(autodetectResultsAtom)
reset(datasetCurrentStorageAtom)
} else if (!areDatasetsEqual(get(datasetCurrentStorageAtom), dataset)) {
} else {
set(datasetCurrentStorageAtom, dataset)
}
},
Expand Down

0 comments on commit 4bfe065

Please sign in to comment.