()
| 16 | * includes a fallback cleanup effect for hydration mismatch cases. |
| 17 | */ |
| 18 | export function HeadContent() { |
| 19 | const tags = useTags() |
| 20 | const hydrated = useHydrated() |
| 21 | |
| 22 | // Fallback cleanup for hydration mismatch cases |
| 23 | // Runs when hydration completes to remove any orphaned dev styles links from DOM |
| 24 | createEffect(() => { |
| 25 | if (hydrated()) { |
| 26 | document |
| 27 | .querySelectorAll(`link[${DEV_STYLES_ATTR}]`) |
| 28 | .forEach((el) => el.remove()) |
| 29 | } |
| 30 | }) |
| 31 | |
| 32 | // Filter out dev styles after hydration |
| 33 | const filteredTags = createMemo(() => { |
| 34 | if (hydrated()) { |
| 35 | return tags().filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR]) |
| 36 | } |
| 37 | return tags() |
| 38 | }) |
| 39 | |
| 40 | return ( |
| 41 | <MetaProvider> |
| 42 | <For each={filteredTags()}>{(tag) => <Asset {...tag} />}</For> |
| 43 | </MetaProvider> |
| 44 | ) |
| 45 | } |
nothing calls this directly
no test coverage detected