From e914560c6b4d84a573cb414b08fc56f47de08dfc Mon Sep 17 00:00:00 2001 From: Peter Ringelmann Date: Fri, 22 May 2026 15:49:41 +0200 Subject: [PATCH] fix(invite): guard against double-mount when init.ts evaluates twice Signed-off-by: Peter Ringelmann --- src/init.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/init.ts b/src/init.ts index afa529b31..c373af7f4 100644 --- a/src/init.ts +++ b/src/init.ts @@ -12,14 +12,22 @@ if (!OCA.Guests) { OCA.Guests = {} } -// Create mount point for the guest form dialog -const guestRoot = document.createElement('div') -guestRoot.setAttribute('id', 'guest-root') -document.body.appendChild(guestRoot) +// NC appends a `?v=...` cache-buster to the script-tag URL but the +// bundled `import` from main.ts doesn't, so this module loads twice. +// Reuse the first mount instead of creating a second Vue app. See #1555. +let guestForm: InstanceType +if (OCA.Guests._guestForm) { + guestForm = OCA.Guests._guestForm +} else { + const guestRoot = document.createElement('div') + guestRoot.setAttribute('id', 'guest-root') + document.body.appendChild(guestRoot) -// Initialize the guest form dialog and expose it -const guestForm = createApp(GuestForm) - .mount('#guest-root') as InstanceType + guestForm = createApp(GuestForm) + .mount('#guest-root') as InstanceType + + OCA.Guests._guestForm = guestForm +} OCA.Guests.openGuestDialog = (app: string, shareWith?: string) => { guestForm.populate({ app }, shareWith)