Skip to content

<f-when> Does Not Re-evaluate After Hydration #7321

@mcritzjam

Description

@mcritzjam

🐛 Bug Report

After client-side hydration, structural template directives (<f-when>,
<f-repeat>) and property bindings (:prop) do not re-evaluate when their
underlying @observable properties change. Simple {{interpolation}} and
attribute bindings DO work reactively, creating an inconsistency that forces
app developers into imperative DOM workarounds.

Field Detail
Expected <f-when condition="showSection"> hides/shows its content when showSection changes.
Actual The <f-when> block reflects only the initial server-rendered state. Toggling the observable has no effect on the DOM. The {{showSection}} interpolation in nearby text DOES update.
Root cause <f-when> is a compile-time directive processed by @microsoft/fast-html during SSR. During defer-and-hydrate, the hydration pass does not subscribe the <f-when> block to the condition observable.
Affected apps settings_btr (back button visibility), downloads_btr (empty state), permission_prompt_btr, all BTR apps using conditional rendering.
Severity P1 — Broken functionality. Any BTR page that needs to show/hide sections based on state changes is affected.
Workaround Imperative DOM manipulation — manually create/remove elements instead of relying on <f-when>. See Workaround A.
Suggested fix Framework-level: <f-when> blocks should subscribe to their condition observable during hydration, mirroring when() behavior in standard FAST Element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions