fix(ui): guard page custom-element registrations against re-registration

The shared jsdom registry persists across test files under isolate:false while
modules re-evaluate per file, so any page imported by two test files threw
NotSupportedError at import time (ui/src/pages/usage/usage-page.test.ts started
failing when gateway-source-replacement.test.ts became a second importer). All
other components already guard with customElements.get; these nine pages were
the only bare defines.
This commit is contained in:
Peter Steinberger
2026-07-17 16:56:23 -04:00
parent b7dd330bd3
commit 76e97ddcdb
9 changed files with 27 additions and 9 deletions

View File

@@ -97,4 +97,6 @@ class AboutPage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-about-page", AboutPage);
if (!customElements.get("openclaw-about-page")) {
customElements.define("openclaw-about-page", AboutPage);
}

View File

@@ -247,4 +247,6 @@ class ActivityPage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-activity-page", ActivityPage);
if (!customElements.get("openclaw-activity-page")) {
customElements.define("openclaw-activity-page", ActivityPage);
}

View File

@@ -1002,5 +1002,7 @@ export class ConfigPage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-config-page", ConfigPage);
if (!customElements.get("openclaw-config-page")) {
customElements.define("openclaw-config-page", ConfigPage);
}
/* oxlint-disable max-lines -- TODO: split this grandfathered oversized file. */

View File

@@ -231,4 +231,6 @@ class DebugPage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-debug-page", DebugPage);
if (!customElements.get("openclaw-debug-page")) {
customElements.define("openclaw-debug-page", DebugPage);
}

View File

@@ -353,4 +353,6 @@ export class MemoryImportPage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-memory-import-page", MemoryImportPage);
if (!customElements.get("openclaw-memory-import-page")) {
customElements.define("openclaw-memory-import-page", MemoryImportPage);
}

View File

@@ -593,4 +593,6 @@ export class ModelProvidersPage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-model-providers-page", ModelProvidersPage);
if (!customElements.get("openclaw-model-providers-page")) {
customElements.define("openclaw-model-providers-page", ModelProvidersPage);
}

View File

@@ -526,4 +526,6 @@ export class ModelSetupPage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-model-setup-page", ModelSetupPage);
if (!customElements.get("openclaw-model-setup-page")) {
customElements.define("openclaw-model-setup-page", ModelSetupPage);
}

View File

@@ -715,4 +715,6 @@ class UsagePage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-usage-page", UsagePage);
if (!customElements.get("openclaw-usage-page")) {
customElements.define("openclaw-usage-page", UsagePage);
}

View File

@@ -711,4 +711,6 @@ class WorktreesPage extends OpenClawLightDomElement {
}
}
customElements.define("openclaw-worktrees-page", WorktreesPage);
if (!customElements.get("openclaw-worktrees-page")) {
customElements.define("openclaw-worktrees-page", WorktreesPage);
}