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

Bug: duplicate render - TemplateObject array garbage collected #27

@luwes

Description

@luwes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions