-
I created a simple repo with following steps:
function thirdPartyFunction() {
const div = document.createElement('div');
div.innerHTML = 'HELLO';
document.body.insertAdjacentElement('beforeend', div);
}
thirdPartyFunction(); In SPA mode, a div element is briefly inserted into the body but disappears after hydration. What causes this discrepancy? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Interesting. In SPA mode, it appears that hydration completely blows out the inner HTML of I was able to get the startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>
);
// wait for hydration to finish, then add the div
setTimeout(thirdPartyFunction, 10);
}); https://stackblitz.com/edit/stackblitz-starters-qa5ubk?file=app%2Fentry.client.tsx |
Beta Was this translation helpful? Give feedback.
-
I haven't played around much with modifying our adding custom logic to @kiliman @wonu - is I haven't seen many custom |
Beta Was this translation helpful? Give feedback.
-
New |
Beta Was this translation helpful? Give feedback.
New
Layout
Export inv2.7.0
elegantly solves above mentioned DOM insertion and inline script issues.