Skip to content

Commit

Permalink
fix: unwatch event handlers when details panel is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
milespetrov committed Feb 21, 2025
1 parent d81f4bb commit d4c01aa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/fixtures/details/components/result-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ const clickShowList = () => {
*/
const detailsClosed = () => {
detailsFixture.value.removeDetailsHilight();
// unwatch when the panel is closed, not when unmounted because a minimized
// panel will be unmounted but still needs to have watchers active.
watchers.value.forEach(unwatch => unwatch());
handlers.value.forEach(handler => iApi.event.off(handler));
// (JR) commenting this out. if user turns off toggle, it shouldnt reset back to on when screen closes.
// detailsStore.hilightToggle = true;
Expand Down Expand Up @@ -545,10 +549,6 @@ onBeforeMount(() => {
});
onBeforeUnmount(() => {
// clean up hooks into various events.
watchers.value.forEach(unwatch => unwatch());
handlers.value.forEach(handler => iApi.event.off(handler));
el.value?.removeEventListener('blur', blurEvent);
el.value?.removeEventListener('keyup', keyupEvent);
});
Expand Down

0 comments on commit d4c01aa

Please sign in to comment.