microsoft / fast

The adaptive interface system for modern web experiences.
https://www.fast.design
Other
9.28k stars 595 forks source link

fix: Nested template renders when it shouldn't in fast-element #6816

Open m-akinc opened 1 year ago

m-akinc commented 1 year ago

🐛 Bug Report

If the first thing in a multiline template (created using html) is another template, that nested template renders at times when it shouldn't.

E.g.

html`${html`foo`}
  `

Note that whitespace in the outer template affect whether this occurs or not. If there are no linebreaks (e.g. html`${html`foo`}`) everything works properly. If there is a space/linebreak before the nested template in a multi-line template, everything works. E.g.

html`
   ${html`foo`}
`

💻 Repro or Code Sample

See Stackblitz

🤔 Expected Behavior

The inner template should not be rendered (when, say, the outer template is excluded by a when condition).

😯 Current Behavior

The inner template keeps getting rendered, even when the rest of the containing template does not.

🔦 Context

Ran into this bug when authoring a custom component that uses a nested template.

nicholasrice commented 1 year ago

Thanks for reporting @m-akinc.

It looks like this is only affecting v1, no repro v2.