Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant