wxt icon indicating copy to clipboard operation
wxt copied to clipboard

Function `createShadowRootUi` avoid render duplicated

Open yunsii opened this issue 1 year ago • 2 comments

Feature Request

If browser.scripting.executeScript all of extension script on chrome.runtime.OnInstalledReason.INSTALL or chrome.runtime.OnInstalledReason.UPDATE, we encounter this situation.

Is your feature request related to a bug?

N/A

What are the alternatives?

We have to wrap createShadowRootUi to check the name of the custom component used to host the ShadowRoot whether existed.

Additional context

N/A

yunsii avatar Jan 19 '24 09:01 yunsii

After the problem is solved, I have to use global variable to control whether the ui is mounted, like window.__mountedNames. I think the implement should going on under the hood.

yunsii avatar Jan 19 '24 12:01 yunsii

Interesting, the ContentScriptContext should be causing the UI to be removed if the install/update events are firing and when if it sees another version of the same script is being executed.

I'll double check this at some point, but it's a low priority rn since you have a work-around.

aklinker1 avatar Jan 19 '24 14:01 aklinker1

There was a bug in the content script context, so this should be fixed by #683!

aklinker1 avatar May 31 '24 13:05 aklinker1

Potential fix released in v0.18.4

aklinker1 avatar May 31 '24 13:05 aklinker1