-
Notifications
You must be signed in to change notification settings - Fork 4
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
@html does not update on hydration #148
Comments
This is tricky b/c this text is not prerendered using an innerHTML action... Can do this to get it back, but I need to test if this is gonna lead to flashes on prod stuff. <script>
import { building } from '$app/environment';
function setInnerHTML(node, html) {
node.innerHTML = html;
return {
destroy() {
node.innerHTML = '';
},
};
}
</script>
{#if building}
<div>
{@html marked.parse(text)}
</div>
{:else}
<div use:setInnerHTML="{marked.parse(text)}"></div>
{/if}
<style>
div {
display: contents;
}
</style> |
OK, it looks like the above workaround doesn't lead to flashes that I can see and still prerenders. It's extra processing time on load, but I don't know have many better ideas at this point. Idea would be to make a standalone component for markdown text, I suppose, and replace all the Trouble is
Sucks, all of these, really.. |
Noting the main issue tracking this in the Svelte repo: sveltejs/svelte#8213 |
Inventory of the components using
@html
tags that will need to be updated to get around this issue:There's a few longstanding issues on the Svelte repo about this, amazingly.
A workaround is to set
innerHtml
with an action, which is what I guess we'll have to do before we can have live updating previews from RNGS.io working..Honestly, amazed this hasn't come up for me before...
Will likely need to scrub all our components for this, but for sure BodyText is first up.
The text was updated successfully, but these errors were encountered: