App router global styles (import 'style.css'
) don't get removed when navigating to a different page
#65672
Labels
bug
Issue was opened via the bug report template.
linear: next
Confirmed issue that is tracked by the Next.js team.
locked
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/global-css-not-getting-removed-8kl8sv
To Reproduce
/foo
and/bar
) in theapp
directory, each import a different CSS file usingimport 'xxx.css'
/foo
to/bar
using the router linkfoo
page's global style still being applied on thebar
pagefoo
page, onlybar
page's global style gets loadedCurrent vs. Expected behavior
Current:
Both
foo
andbar
pages' global styles are applied when navigating from/foo
to/bar
using the router linkExpected:
Only
bar
page's global styles should be loaded.foo
page's global styles should be cleaned up after navigating to/foo
.Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023 Available memory (MB): 4102 Available CPU cores: 2 Binaries: Node: 20.11.1 npm: 10.2.4 Yarn: 1.22.19 pnpm: 8.15.4 Relevant Packages: next: 14.3.0-canary.59 // Latest available version is detected (14.3.0-canary.59). eslint-config-next: 14.2.1 react: 18.2.0 react-dom: 18.2.0 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local) and production build (next build && next start)
Additional context
No response
The text was updated successfully, but these errors were encountered: