-
-
Notifications
You must be signed in to change notification settings - Fork 65
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
Issue is observed in both of the following environments:
Stackblitz env:
> node --version
v20.19.1
Vite: v7.0.1
React: 19.1.0
My env:
Node v22.8
React 18.2.0
Vite 5.1.0
Reproduction
https://stackblitz.com/edit/vitejs-vite-ijas5txg?file=src%2FApp.tsx
Repro steps:
- The app is initially rendering the
<Page2>element, which does not set any<meta>tags. - Observe the
<head>of the rendered app. Observe that thetitletag is set to the fallback title "Example fallback" and there is a description<meta>tag with content "some description" as configured in theinitparameter of thecreateHeadfunction. (Expected) - Click the button labeled "Page 1" to mount the
<Page1>component. Observe that the title and description are updated based on the values set in theuseHeadhook in the<Page1>component. (Expected). - Click the button "Page 2" to unmount the
<Page1>component and remount the<Page2>component. - Observe that the meta tags are still displaying the
Page1values, even though the<Page1>component was unmounted. (Unexpected behavior)
Expected behavior:
The <meta> values configured by the <Page1> component are removed when the component is unmounted, and the values from the init parameter of the createHead function are added again.
Describe the bug
When a component unmounts, it doesn't unset <meta> tags that were configured in that component, nor are the <meta> tags reset to the values in the init parameter of the createHead function.
Additional context
I'm new to this library, so I might be completely misunderstanding the expected behavior here. Thanks for your help!
Logs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working