next.js
87141665 - fix issues loading CSS in default slots (#61428)

Commit
2 years ago
fix issues loading CSS in default slots (#61428) ### 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
Author
Parents
Loading