Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useHead body style attributes cleared when changing pages #27712

Closed
DevChanQ opened this issue Jun 19, 2024 · 4 comments
Closed

useHead body style attributes cleared when changing pages #27712

DevChanQ opened this issue Jun 19, 2024 · 4 comments

Comments

@DevChanQ
Copy link

Environment

"@unhead/vue": "^1.9.13",
"nuxt": "^3.12.1"

Reproduction

Stackblitz

Describe the bug

Created an issue in the unhead repo unjs/unhead#357 but not getting any response there. Felt it's appropriate to mention it here since it affects nuxt users quite a bit.

I am currently using useHead to update body style attributes for different pages. It was not working for some reason, the style would be cleared no matter what.

After some investigation, I found that the styles are cleared because the tracked scope includes the value of the attribute, making the previous pending side effect unable to be removed.
https://github.com/unjs/unhead/blob/c0ca0c1cc196928b40952d525f7f5e0d9edd54ce/packages/dom/src/renderDOMHead.ts#L111-L120

Additional context

No response

Logs

No response

Copy link

stackblitz bot commented Jun 19, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@manniL
Copy link
Member

manniL commented Jun 19, 2024

I think tracking it in unhead seems to be the best way (cc @harlan-zw)

@harlan-zw
Copy link
Contributor

harlan-zw commented Jun 20, 2024

@DevChanQ Please be mindful that I, like most open-source maintainers, have limited bandwidth in responding to issues. Creating another issue won't expedite the process.

Closing as the existing issue is tracking.

@harlan-zw harlan-zw closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2024
@DevChanQ
Copy link
Author

My apologies 🤝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants