Should this be an RFC?
Which package is this a feature request for?
Other/unknown (please mention in description)
Description
in server frameworks like next.js, it may be possible that enable-lit-ssr.js might run multiple times in the server, leading to createElement being wrapped multiple times.
part of the observation described #4527 (comment) and from the stackblitz example shared there, refreshing the page causes error because multiple <template shadowrootmode="open"> elements are added to a single custom element.
we're already setting a global flag from this so we could guard the patching of createElement behind that flag too.
Alternatives and Workarounds
.