Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cannot define multiple custom elements with the same tag #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

miohtama
Copy link

@miohtama miohtama commented May 19, 2024

  • Currently TonConnect UI always initialises its custom web component "global styles" when new TonconnectUI() is called
  • Currently defineStylesRoot calls customElements.define(globalStylesTag)
  • customElements.define() can be called only once
    -> Trying to initialise TonConnectUI in the same app twice crashes with
    -> This prevents building an app that has TonConnectUI loaded twice or used twice
Cannot define multiple custom elements with the same tag

(Telegram Desktop Webkit / Safari error. The actual error message may vary)

As a workaround, this patch only calls customElements.define if we do not have our custom styles element defined yet by checking the registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant