Remix: Styles missing when going back after reaching a not found route through Link component.
See original GitHub issueWhat package has an issue
Describe the bug
Hi,
During development I have some Links pointing to non-existing (yet) routes. I have noticed that after reaching the 404 page after clicking them and going back (using the browser button) the previous styles are missing.
The original styles are NOT missing if:
- You go back WRITING the previous url in the browser (instead of clicking the back button).
- You go back using the browser button from an EXISTING route (instead of a non-existing one).
- You go back using the browser button from a NON-EXISTING route that you WROTE in the browser (instead of using the Link component).
I think I have followed the sample code at entry-server.tsx to inject the styles. In fact all other styles are working flawlessly
import {renderToString} from 'react-dom/server'
import {RemixServer} from 'remix'
import type {EntryContext} from 'remix'
import {injectStylesIntoStaticMarkup} from '@mantine/ssr'
export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
) {
const markup = renderToString(
<RemixServer context={remixContext} url={request.url} />
)
responseHeaders.set('Content-Type', 'text/html')
return new Response(
'<!DOCTYPE html>' + injectStylesIntoStaticMarkup(markup),
{
status: responseStatusCode,
headers: responseHeaders
}
)
}
Note: I think the package that has the issue is “@mantine/ssr” but it didn’t show at the package dropdown selection.
Thank you for your help
In which browser did the problem occur
Chrome
If possible, please include a link to a codesandbox with the reproduced problem
No response
Do you know how to fix the issue
No
Are you willing to participate in fixing this issue and create a pull request with the fix
No response
Possible fix
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Style tags disappear from Head during Error/Catch Boundary ...
Remix thinks this is just a resource route, so it'll server render it without any of the parent routes.
Read more >Remixing React Router
A new package, @remix-run/router will combine all the relevant functionality from History, React Router's matching, and Remix's data management ...
Read more >Migrating to React Router v6: A complete guide
Migrate your React Router applications from v5 to v6 with this in-depth guide, including a review of additions and improvements from v5.
Read more >Can't resolve 'react-router-dom' - Stack Overflow
This error occurs because of react-router-dom npm package is missing. install them by using the above cmd. Share.
Read more >React Router V6 Tutorial - Routes, Redirecting, UseNavigate ...
Hey everyone, in this video I teach you all the new version of React Router Dom. I have an old video teaching this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As far as I know, this is an issue with Remix, not Mantine. Remix team plans to fix it in future versions.
Is there a fix to this?