Skip to content

Commit

Permalink
Retain sample selection after modal pop history state (#4623)
Browse files Browse the repository at this point in the history
* new e2e assertions

* fix modal history pops
  • Loading branch information
benjaminpkane authored Aug 6, 2024
1 parent 35084b7 commit 73eec95
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
36 changes: 21 additions & 15 deletions app/packages/app/src/Sync.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,29 @@ const dispatchSideEffect = ({
return;
}

session.modalSelector = nextEntry.state.modalSelector;

if (
currentEntry.state.event === "modal" ||
nextEntry.state.event === "modal"
) {
if (nextEntry.state.event !== "modal") {
session.selectedLabels = [];
}
commitMutation<setSampleMutation>(environment, {
mutation: setSample,
variables: {
groupId: nextEntry.state.modalSelector?.groupId,
id: nextEntry.state.modalSelector?.id,
subscription,
},
});
return;
}

session.selectedLabels = [];
session.selectedSamples = new Set();
session.modalSelector = nextEntry.state.modalSelector;


const currentDataset: string | undefined =
// @ts-ignore
Expand All @@ -139,20 +159,6 @@ const dispatchSideEffect = ({
return;
}

if (
currentEntry.state.event === "modal" ||
nextEntry.state.event === "modal"
) {
commitMutation<setSampleMutation>(environment, {
mutation: setSample,
variables: {
groupId: nextEntry.state.modalSelector?.groupId,
id: nextEntry.state.modalSelector?.id,
subscription,
},
});
return;
}

// @ts-ignore
const data: DatasetPageQuery$data = nextEntry.data;
Expand Down
6 changes: 6 additions & 0 deletions e2e-pw/src/oss/specs/selection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,11 @@ extensionDatasetNamePairs.forEach(([extension, datasetName]) => {
await modal.assert.verifySelectionCount(1);
await modal.close();
await grid.assert.isSelectionCountEqualTo(1);

await grid.openNthSample(1);
await modal.assert.verifySelectionCount(1);
await grid.url.back();
await modal.assert.isClosed();
await grid.assert.isSelectionCountEqualTo(1);
});
});

0 comments on commit 73eec95

Please sign in to comment.