Skip to content

Commit

Permalink
Merge pull request #96 from unipept/fix/remove-compared-assays-projec…
Browse files Browse the repository at this point in the history
…t-init

Fix reset selected assays when changing project
  • Loading branch information
pverscha authored Nov 25, 2020
2 parents 356da75 + 6ae471c commit b51286a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/state/ComparativeStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const comparativeMutations: MutationTree<ComparativeState> = {
if (id >= 0) {
state.selectedAssays.splice(id, 1);
}
},
RESET_SELECTED_ASSAYS(state: ComparativeState) {
state.selectedAssays.splice(0, state.selectedAssays.length);
}
}

Expand All @@ -46,6 +49,10 @@ const comparativeActions: ActionTree<ComparativeState, any> = {

removeSelectedAssay(store: ActionContext<ComparativeState, any>, assay: Assay) {
store.commit("REMOVE_SELECTED_ASSAY", assay);
},

resetSelectedAssays(store: ActionContext<ComparativeState, any>) {
store.commit("RESET_SELECTED_ASSAYS");
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/state/ProjectStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ const projectActions: ActionTree<ProjectState, any> = {
Study[]
]
) {
await store.dispatch("resetSelectedAssays");

// Make sure that all assays from the previously loaded project are gone.
for (const assayData of store.rootGetters.assays) {
store.dispatch("removeAssay", assayData.assay);
await store.dispatch("removeAssay", assayData.assay);
}

if (!projectDirectory.endsWith("/")) {
Expand Down

0 comments on commit b51286a

Please sign in to comment.