Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vuetify): add patch for expandable panels with v-model #624

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

PaulHax
Copy link
Collaborator

@PaulHax PaulHax commented Jul 15, 2024

Dynamic number of panels with v-model='panels' has an error when removing a panel.

Steps: When I load the prostate, click checkbox to "select all studies," then "delete selected" -> seeing errors [Vue warn]: Unhandled error during execution of beforeUnmount hook and Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'value') at group.ts:338:59

I did not reproduce the error in the Vuetify playground, so not sure how to complain:
playground

@floryst
Copy link
Collaborator

floryst commented Jul 16, 2024

Thanks for finding that! I'm looking into it again as well, since something weird is going on.

@floryst
Copy link
Collaborator

floryst commented Jul 16, 2024

This is the commit that causes issues for us: vuetifyjs/vuetify@72a2194

I suspect this has to do with some race between deleting an expansion panel and the model. I was seeing some strange case where the proxied group.ts items array had 1 item, but had length 2, resulting in an undefined 2nd slot.

This diff worked for me; try it on your branch to make sure:

diff --git a/src/components/DataBrowser.vue b/src/components/DataBrowser.vue
index 954e84c..8929450 100644
--- a/src/components/DataBrowser.vue
+++ b/src/components/DataBrowser.vue
@@ -46,7 +46,18 @@ export default defineComponent({
       () => imageStore.idList.filter((id) => isRegularImage(id)).length > 0
     );
 
-    const panels = ref<string[]>([SAMPLE_DATA_KEY, DICOM_WEB_KEY]);
+    const panels = ref<string[]>([SAMPLE_DATA_KEY]);
+
+    watch(
+      computed(() => dicomWeb.isConfigured),
+      (configured) => {
+        if (configured) {
+          panels.value.push(DICOM_WEB_KEY);
+        } else {
+          removeFromArray(panels.value, DICOM_WEB_KEY);
+        }
+      }
+    );
 
     watch(
       [hasAnonymousImages, patients] as const,
@@ -67,6 +78,7 @@ export default defineComponent({
     const hideSampleData = computed(() => dataBrowserStore.hideSampleData);
 
     const deletePatient = (key: string) => {
+      removeFromArray(panels.value, key);
       dicomStore.patientStudies[key]
         .flatMap((study) => dicomStore.studyVolumes[study])
         .forEach(datasetStore.remove);

@PaulHax
Copy link
Collaborator Author

PaulHax commented Jul 16, 2024

Your 10X!! Updated the PR. Removed the vuetify patch, added watchs removing from panels for the other cases.

@floryst
Copy link
Collaborator

floryst commented Jul 16, 2024

LGTM!

@floryst floryst merged commit a7c727f into Kitware:streaming-base Jul 16, 2024
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants