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

All JS modulepreload tags are within ROOT DIV element #21

Open
jvenki opened this issue Oct 15, 2024 · 2 comments
Open

All JS modulepreload tags are within ROOT DIV element #21

jvenki opened this issue Oct 15, 2024 · 2 comments

Comments

@jvenki
Copy link

jvenki commented Oct 15, 2024

Thanks for creating this wonderful library to enable Selective Hydration.

After this change, I find all the "modulepreload" link tags placed within our new <div id="root"> element. I am not sure why though Remix's Meta and Links are within the createHead method only.

export const Head = createHead(() => {
    const data = useRouteLoaderData<typeof loader>("root");
    return (
        <>
            <meta charSet="utf-8" />
            <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, interactive-widget=resizes-content" />
            <meta name="robots" content="index, follow" />
            <Meta />
            <Links />
        </>
    );
});

I am also using Layout Export feature of Remix and my Layout is as follows

export function Layout({ children }: { children: React.ReactNode }) {
    return (
        <>
            <Head />
            {children}
            <ScrollRestoration />
            <Scripts />
        </>
    );
}

Is there anything I am doing wrong here? This is just placing the various modulepreload tags later when it should ideally have been in the head

@jvenki
Copy link
Author

jvenki commented Oct 15, 2024

Is it because we are doing renderToString on HEAD and Meta and Links do not have any context on the current route and therefore not reading the vite manifest properly to inject the relevant modulepreload links. Later, <Scripts /> is bringing it and somehow moving it to the top of the ROOT element.

@Xiphe
Copy link
Owner

Xiphe commented Jan 5, 2025

Sorry for the late reply. Unfortunately I have not been able to maintain this for personal reasons. Is this question still relevant?

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

No branches or pull requests

2 participants