Repository navigation
Commit db4f940
authored
perf: fix createGlobalStyle test performance regression (#5679)
Two changes to eliminate unnecessary overhead in client/test environments:
1. Move synchronous renderStyles to only run on server/RSC paths. In
client mode, the useLayoutEffect already handles style rendering,
so the synchronous call during component execution was double work.
2. Remove removeGlobalStyleTag from client cleanup. This function does
querySelectorAll for data-styled-global tags, which only exist after
SSR hydration. In pure client/test environments it was a no-op DOM
query on every global style unmount. globalStyle.removeStyles already
handles client-side StyleSheet cleanup.
Fixes #56741 parent 6b7fe3f commit db4f940
2 files changed
Lines changed: 12 additions & 10 deletions
File tree
- .changeset
- packages/styled-components/src/constructors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | | - | |
83 | 80 | | |
84 | 81 | | |
85 | 82 | | |
| |||
0 commit comments