perspective-dev/perspective · error
Custom element " " is already registered; skipping…
Error message
Custom element "${name}" is already registered; skipping duplicate registration (Perspective was loaded more than once on this page). What it means
Generic duplicate-registration guard for perspective-viewer custom elements: before defining a custom element named ${name}, the code checks the registry and, if already defined, warns instead of letting customElements.define throw 'already defined'. It indicates the perspective-viewer module was evaluated more than once on the page.
Solutions
- Ensure the perspective-viewer bundle is imported/evaluated only once per page
- Check bundler config for duplicate chunks or both ESM and UMD builds being loaded
- If multiple perspective copies are unavoidable, treat the warning as safe — registration is skipped
- Align all perspective package versions to a single build
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at rust/perspective-viewer/src/rust/utils/custom_element.rs:20 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of perspective-dev/perspective@11c8238c0c (2026-09-09).
Data as JSON: /api/errors/067e2b47bdca6f3f.
Report an issue: GitHub.
Appendix: source
Thrown at rust/perspective-viewer/src/rust/utils/custom_element.rs:20
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
// ┃ This file is part of the Perspective library, distributed under the terms ┃
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
//! Utilities for building JavaScript Custom Elements with Rust.
use wasm_bindgen::prelude::*;
#[wasm_bindgen(inline_js = r#"
export function bootstrap(psp, name, clsname, statics) {
if (customElements.get(name)) {
console.warn(`Custom element "${name}" is already registered; skipping duplicate registration (Perspective was loaded more than once on this page).`);
return;
}
const cls = psp[clsname];
const proto = cls.prototype;
class x extends HTMLElement {
constructor() {
super();
this._instance = new cls(this);
}
}
const names = Object.getOwnPropertyNames(proto);
for (const key of names) {
if ('get' in Object.getOwnPropertyDescriptor(proto, key)) {
Object.defineProperty(x.prototype, key, {
get: function() {
return this._instance[key];View on GitHub (pinned to 11c8238c0c)