question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remix: Styles missing when going back after reaching a not found route through Link component.

See original GitHub issue

What package has an issue

@mantine/core

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:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rtivitalcommented, Feb 18, 2022

As far as I know, this is an issue with Remix, not Mantine. Remix team plans to fix it in future versions.

0reactions
jca41commented, Oct 10, 2022

Is there a fix to this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found