-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
CSS Modules from default.tsx page are not loading on a parallel route hard navigation #52245
Comments
Ran into the same bug |
I might have stumbled into the same issue. Styles from CSS Modules are not added to HTML server-side so a flash of unstyled content happens after (what i believe is) rehydration. Not using app folder in my setup but otherwise more or less identical regarding how styles are imported and used in a component. This only happens in development. When building the app for production the styles are included in the SSR. |
Any updates? |
I am facing the same issue! I have a production app that has this bug: When you go to https://staging.qawalleb.com every thing works as expected. After navigating to https://staging.qawalleb.com/new through the menu The styles are not getting loaded. Please login first to see the issue as /new is a protected route. (It's a staging env, so no data is kept) |
Same issue here #49871 |
I got into the same bug. |
@shuding I'm sure you're very busy, but is this issue on anyone's radar? I can confirm that this behavior persists in 13.4.19. |
This comment has been minimized.
This comment has been minimized.
I believe this is related: The issue I am seeing is client side navigating, using I tried moving the css from the components to The only thing that did work is removing the
|
Same issue in 14.0.4. I had to move all my css up to the layout to get this to work |
I'm working on a project that uses CSS Modules, so all styles are scoped (can't put the styles in the layout or anything like that). I just can't get it working on Another thing regarding I'm using a structure like below:
And my import Page from './page'
export default Page This is why I need the page rendering exactly as always (accessed directly or not). So it seems a "dummy" or "filler" file to me. Really don't know why the behavior couldn't be the same as Any thoughts regarding the styling problems? It seems tightly related to this issue. |
### What When using a default slot that re-exports another page, the CSS entries (and presumably other client reference modules, like JS entries) that correspond with the re-exported page won't be loaded, resulting in CSS styles not being applied. ### Why `next-app-loader` constructs the path to the default segment but special cases the `children` slot (which is used as the page), to mark the segment as an empty string. This is so that the parallel default file can be loaded. However the way that `defaultPath` is constructed, it assumes that `actualSegment` won't be an empty string, and constructs an invalid path like so: `app/example//default.tsx` When we go to look up the JS/CSS entries from the client reference manifest, the key will be incorrect and so it won't find the files for it, resulting in this bug. ### How This moves the `/` delimiting to be part of the creation of the `actualSegment` variable so that we only append it when we know we aren't setting it to be an empty string. Fixes #52245 Fixes #49871 Closes NEXT-2309 Closes NEXT-2310
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 Binaries: Node: 18.16.0 npm: 9.5.1 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 13.4.18-canary.0 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 4.9.5 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/tjabbe/css-modules-parallel-routes-default-page
https://codesandbox.io/p/github/tjabbe/css-modules-parallel-routes-default-page/main
To Reproduce
http://localhost:3000
Go to /demo parallel route
link --> headline should still have its css module styling/demo
route --> headline lost its styling from the CSS Module class (global styles work fine)Describe the Bug
Hard navigating to a parallel route prevents CSS Modules styles inside
app/default.tsx
page from being injected.As you can see on the screenshot, after a hard navigation to
/demo
, the class gets applied to the<Headline>
component, but no css is loaded (except for the global css loaded in the layout)I could pin down which PR caused this to stop working, it got released in v13.4.6-canary.5: #51018
Expected Behavior
CSS Modules from
app/default.tsx
page should load when hard navigating to a parallel route.Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
NEXT-2310
The text was updated successfully, but these errors were encountered: