You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Route transitions should work in preview and production like they do in development.
Actual Behavior
In preview and production, Remix unloads the CSS for the current route as soon as the next route is navigated to, leaving the current route unstyled during the exit transition.
The reproduction follows the AnimatedOutlet pattern described below.
This may also affect regular CSS using URL imports, as they seem to be similarly handled as route based stylesheets which probably get unloaded in the same way.
Obviously this isn't an issue unless introducing something like React Transition Group or Framer Motion, where the current route component isn't unmounted for the duration of the exit transition, so it's not technically a bug with Remix, but it's not clear from the various discussions and articles over time how to overcome this in order to properly achieve route transitions.
I've only been able to work around the above by forcing all CSS to be bundled together by adding something like the following to the root route (ie. root.tsx), but this isn't ideal as it's effectively opting out of more granular CSS bundling and it's benefits.
Reproduction
npm run dev
Link
componentnpm run dev
Link
componentSystem Info
Used Package Manager
npm
Expected Behavior
Route transitions should work in preview and production like they do in development.
Actual Behavior
In preview and production, Remix unloads the CSS for the current route as soon as the next route is navigated to, leaving the current route unstyled during the exit transition.
The reproduction follows the
AnimatedOutlet
pattern described below.remix-run/react-router#8008 (comment)
Styles are implemented using Vanilla Extract, though presumably this affects any CSS solution requiring CSS bundling.
https://remix.run/docs/en/main/guides/css-files#css-bundling-is-required-for-some-css-solutions
This may also affect regular CSS using URL imports, as they seem to be similarly handled as route based stylesheets which probably get unloaded in the same way.
https://remix.run/docs/en/main/styling/css
Obviously this isn't an issue unless introducing something like React Transition Group or Framer Motion, where the current route component isn't unmounted for the duration of the exit transition, so it's not technically a bug with Remix, but it's not clear from the various discussions and articles over time how to overcome this in order to properly achieve route transitions.
I've only been able to work around the above by forcing all CSS to be bundled together by adding something like the following to the root route (ie.
root.tsx
), but this isn't ideal as it's effectively opting out of more granular CSS bundling and it's benefits.Ideally, there should be some way to delay Remix completely unloading a route, or at least it's styles in this case.
The text was updated successfully, but these errors were encountered: