https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42189
--- Comment #55 from Paul Derscheid <[email protected]> --- Created attachment 198941 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198941&action=edit Bug 42189: (QA follow-up) Stop mutating caller input in registerWidget - registerWidget previously assigned markRaw(component) back onto the caller's WidgetRegistryEntry and, for sync components, set .name directly on the caller's component - Shallow-clone the sync component before defaulting its name and applying markRaw, and store a fresh entry in the registry via { ...entry, component: markRaw(component) } instead of reusing the caller's object - defineAsyncComponent already returns a fresh wrapper, so the async path is unchanged in spirit - Closes three concrete failure modes for plugin authors: - Object.freeze'd entries hit TypeError on the .component assignment and registration silently aborts before the koha:widget-registered event fires - Entry reuse across two registerWidget calls carries state from the first into the second - Reading entry.component after register() returns the markRaw'd value rather than what was passed in - No public API change; the registry stores the same data, just without touching caller-owned objects To test: - yarn js:build - In a browser console on /cgi-bin/koha/erm/erm.pl, dynamic- import islands.esm.js, then call registerWidget on a frozen entry, e.g.: const e = Object.freeze({ id: "T", module: "erm", component: { name: "T", setup() { return () => null } } }); registerWidget(e); Confirm no TypeError and the koha:widget-registered event fires -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
