Bugzilla – Attachment 183293 Details for
Bug 40150
Prevent uncaught error on multiple attempts to 'define' on 'CustomElementsRegistry' in islands.ts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40150: Prevent uncaught error on multiple attempts to 'define' on 'CustomElementsRegistry' in islands.ts
Bug-40150-Prevent-uncaught-error-on-multiple-attem.patch (text/plain), 1.83 KB, created by
David Nind
on 2025-06-16 22:01:09 UTC
(
hide
)
Description:
Bug 40150: Prevent uncaught error on multiple attempts to 'define' on 'CustomElementsRegistry' in islands.ts
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-06-16 22:01:09 UTC
Size:
1.83 KB
patch
obsolete
>From bff226625477ac33112b743eabfd60b9eb0d8bc8 Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Mon, 16 Jun 2025 17:29:41 +0200 >Subject: [PATCH] Bug 40150: Prevent uncaught error on multiple attempts to > 'define' on 'CustomElementsRegistry' in islands.ts > >If the name is already in use, we just return. > >It might make sense to have a console.debug() or similar to notify >developers that this is happening. Open for other opinions. > >To test: >1) Apply the first patch which adds an additional hydrate call in main-container.inc >2) Go to acqui/acqui-home.pl >3) Verify that you see this error in the dev tool's console tab: >Uncaught (in promise) NotSupportedError: Failed to execute 'define' on 'CustomElementRegistry': the name "acquisitions-menu" has already been used with this registry >4) Apply the second patch >5) Run `yarn js:build` in ktd (assuming ktd). >6) Reload the page without cached assets (Ctrl/Cmd + Shift + R) and verify that the uncaught error is gone. >7) Sign off. > >There's an additional problem here I (and probably you) noticed. But that's unrelated to this bug. > >Signed-off-by: David Nind <david@davidnind.com> >--- > koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts | 4 ++++ > 1 file changed, 4 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts b/koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts >index 808b39d895..dcc20afaba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts >@@ -107,6 +107,10 @@ export function hydrate(): void { > } > > const component = await importFn(); >+ if (customElements.get(name)) { >+ return; >+ } >+ > customElements.define( > name, > defineCustomElement(component as any, { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40150
:
183287
|
183288
|
183292
| 183293