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

Bug: duplicate render - TemplateObject array garbage collected #27

Open
luwes opened this issue Dec 10, 2022 · 0 comments
Open

Bug: duplicate render - TemplateObject array garbage collected #27

luwes opened this issue Dec 10, 2022 · 0 comments

Comments

@luwes
Copy link

luwes commented Dec 10, 2022

Just putting it here for visibility. I think it's a Chrome browser bug.

We ran in a rare case with Mux player where the contents of the player was duplicate rendered.
One fragment below the other.

The reason being that the frozen array produced by the tagged template was not identical for the same site of a template.
This leads to the cache being invalidated and so appendChild was called multiple times for the same template, see below code snippet.

https://github.com/github/jtml/blob/main/src/template-result.ts#L43-L56

Related issue muxinc/elements#517


I looked at some other implementations like Lit and uhtml and they do seem to replace the fragment fully in case the cache invalidation happens. This might be an okay workaround.

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

No branches or pull requests

1 participant