Skip to content

Toaster (Sonner) losing styles after navigating back from Error boundary #9318

Discussion options

You must be logged in to vote

I was able to solve it with following steps;

copy style.css from sonner repo and add it to your project e.g. ./styles/sonner.css
add following code to your root.tsx file to import styles using links function;

import { cssBundleHref } from '@remix-run/css-bundle';
import styles from '~/styles/global.css?url';
import sonnerStyles from '~/styles/sonner.css?url';

export const links: LinksFunction = () => [
  { rel: 'stylesheet', href: styles },
  { rel: 'stylesheet', href: sonnerStyles },
  ...(cssBundleHref ? [{ rel: 'stylesheet', href: cssBundleHref }] : []),
];

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by merthanmerter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant