From 6a8a7c20ca9abd55ced3923e4fd6fb15f35a9ac0 Mon Sep 17 00:00:00 2001 From: Kari Lavikka Date: Fri, 24 Jan 2025 12:48:21 +0200 Subject: [PATCH] fix: reset the selected patient if it's not found in the data Properties are saved into the session storage. If the dataset is updated and the page is refreshed, the saved patient may point to a non-existing patient. --- src/gui/gui.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/gui.ts b/src/gui/gui.ts index 29684f1..09a487f 100644 --- a/src/gui/gui.ts +++ b/src/gui/gui.ts @@ -51,6 +51,9 @@ export function setupGui( let translateY = 0; const patients = Array.from(new Set(tables.samples.map((d) => d.patient))); + if (generalProps.patient && !patients.includes(generalProps.patient)) { + generalProps.patient = null; + } generalProps.patient ??= patients[0]; const gui = new GUI({ container: jellyfishGui });