From 6ef6a454c2c28547b5a370240a12ccb12ddeaab1 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 26 Oct 2026 17:21:51 +0545 Subject: [PATCH 1/4] fix: teardown properly Signed-off-by: Saw-jan --- src/reference.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/reference.js b/src/reference.js index c814e1db9..221d066b1 100644 --- a/src/reference.js +++ b/src/reference.js @@ -15,7 +15,10 @@ __webpack_nonce__ = btoa(OC.requestToken) /* eslint-disable-next-line no-undef */ __webpack_public_path__ = OC.linkTo(APP_ID, 'js/') -// this is where we associate our widget component with the richobjects that we return in the reference provider +const widgetApps = new WeakMap() +// INFO: this is where we associate our widget component with the richobjects +// that we return in the reference provider. +// Link preview card. registerWidget(`${APP_ID}_work_package`, async (el, { richObjectType, richObject, accessible }) => { // here we lazy load the components so it does not slow down the initial page load const { createApp } = await import(/* webpackChunkName: "reference-wp-lazy" */'vue') @@ -28,8 +31,14 @@ registerWidget(`${APP_ID}_work_package`, async (el, { richObjectType, richObject }) setupGlobalProperties(widget) widget.mount(el) + widgetApps.set(el, widget) +}, (el) => { + widgetApps.get(el)?.unmount() + widgetApps.delete(el) }) +// INFO: register OpenProject work packages search component inside the Smart Picker. +// Shows OpenProject smart picker when using "/" command in the chat registerCustomPickerElement('openproject-work-package-ref', async (el, { providerId, accessible }) => { const { createApp } = await import(/* webpackChunkName: "reference-picker-lazy" */'vue') const { default: WorkPackagePickerElement } = await import(/* webpackChunkName: "reference-picker-lazy" */'./views/WorkPackagePickerElement.vue') @@ -41,7 +50,7 @@ registerCustomPickerElement('openproject-work-package-ref', async (el, { provide setupGlobalProperties(app) const vueElement = app.mount(el) - return new NcCustomPickerRenderResult(vueElement.$el, vueElement) + return new NcCustomPickerRenderResult(vueElement.$el, app) }, (el, renderResult) => { - renderResult.object.$destroy() + renderResult.object.unmount() }) From b7d27e10069b8aade43829836bb86b6812423a47 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 26 Oct 2026 18:51:52 +0545 Subject: [PATCH 2/4] fix: dispatch native DOM submit event Vue3 removed the $on instance method, and $emit triggers component events rather than native DOM events. Therefore, dispatch a native DOM event to notify external listeners. Signed-off-by: Saw-jan --- src/components/tab/SearchInput.vue | 44 ++++++++++++++++---------- src/reference.js | 15 ++++----- src/views/WorkPackagePickerElement.vue | 18 +---------- 3 files changed, 34 insertions(+), 43 deletions(-) diff --git a/src/components/tab/SearchInput.vue b/src/components/tab/SearchInput.vue index f3b2e046e..157fc63ef 100644 --- a/src/components/tab/SearchInput.vue +++ b/src/components/tab/SearchInput.vue @@ -5,7 +5,8 @@ -->