styled-components 6.4.0-prerelease.8 → 6.4.0-prerelease.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/styled-components.browser.cjs.js +1 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +2 -2
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +16 -7
- package/dist/styled-components.js.map +1 -1
- package/dist/styled-components.min.js +2 -2
- package/dist/styled-components.min.js.map +1 -1
- package/native/dist/styled-components.native.cjs.js +1 -1
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +1 -1
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
'data-styled';
|
|
12
12
|
const SC_ATTR_ACTIVE = 'active';
|
|
13
13
|
const SC_ATTR_VERSION = 'data-styled-version';
|
|
14
|
-
const SC_VERSION = "6.4.0-prerelease.
|
|
14
|
+
const SC_VERSION = "6.4.0-prerelease.9";
|
|
15
15
|
const SPLITTER = '/*!sc*/\n';
|
|
16
16
|
const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
17
17
|
function readSpeedyFlag(name) {
|
|
@@ -1539,16 +1539,23 @@
|
|
|
1539
1539
|
// Client-side lifecycle: render styles in effect and clean up on unmount.
|
|
1540
1540
|
// false and IS_RSC are build/module-level constants, so this doesn't violate rules of hooks.
|
|
1541
1541
|
{
|
|
1542
|
-
//
|
|
1543
|
-
// (
|
|
1544
|
-
//
|
|
1545
|
-
//
|
|
1542
|
+
// globalStyle is included in deps so HMR-induced module re-evaluation
|
|
1543
|
+
// (which creates a new GlobalStyle instance) triggers effect re-run.
|
|
1544
|
+
// For static rules, renderStyles exits early after the first injection
|
|
1545
|
+
// (via hasNameForId check), so the extra dep is effectively free at runtime.
|
|
1546
1546
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1547
1547
|
const effectDeps = globalStyle.isStatic
|
|
1548
|
-
? [instance, ssc.styleSheet]
|
|
1549
|
-
: [instance, props, ssc.styleSheet, theme, ssc.stylis];
|
|
1548
|
+
? [instance, ssc.styleSheet, globalStyle]
|
|
1549
|
+
: [instance, props, ssc.styleSheet, theme, ssc.stylis, globalStyle];
|
|
1550
|
+
const prevGlobalStyleRef = React.useRef(globalStyle);
|
|
1550
1551
|
React.useLayoutEffect(() => {
|
|
1551
1552
|
if (!ssc.styleSheet.server) {
|
|
1553
|
+
// HMR creates a new globalStyle instance but the componentId stays stable
|
|
1554
|
+
// (SWC plugin assigns by file location), so stale hasNameForId hits skip injection.
|
|
1555
|
+
if (prevGlobalStyleRef.current !== globalStyle) {
|
|
1556
|
+
ssc.styleSheet.clearRules(styledComponentId);
|
|
1557
|
+
prevGlobalStyleRef.current = globalStyle;
|
|
1558
|
+
}
|
|
1552
1559
|
renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
|
|
1553
1560
|
}
|
|
1554
1561
|
return () => {
|
|
@@ -2260,6 +2267,7 @@
|
|
|
2260
2267
|
prev[1] === theme &&
|
|
2261
2268
|
prev[2] === ssc.styleSheet &&
|
|
2262
2269
|
prev[3] === ssc.stylis &&
|
|
2270
|
+
prev[7] === componentStyle &&
|
|
2263
2271
|
shallowEqualContext(prev[0], props, prev[4])) {
|
|
2264
2272
|
context = prev[5];
|
|
2265
2273
|
generatedClassName = prev[6];
|
|
@@ -2280,6 +2288,7 @@
|
|
|
2280
2288
|
propsKeyCount,
|
|
2281
2289
|
context,
|
|
2282
2290
|
generatedClassName,
|
|
2291
|
+
componentStyle,
|
|
2283
2292
|
];
|
|
2284
2293
|
}
|
|
2285
2294
|
}
|