Skip to content

Commit

Permalink
[Fizz] Do not reinsert stylesheets after initial insert (#27586)
Browse files Browse the repository at this point in the history
The loading state tracking for suspensey CSS is too complicated. Prior
to this change it had a state it could enter into where a stylesheet was
already in the DOM but the loading state did not know it was inserted
causing a later transition to try to insert it again.

This fix is to add proper tracking of insertions on the codepaths that
were missing it. It also modifies the logic of when to suspend based on
whether the stylesheet has already been inserted or not.

This is not 100% correct semantics however because a prior commit could
have inserted a stylesheet and a later transition should ideally be able
to wait on that load before committing. I haven't attempted to fix this
yet however because the loading state tracking is too complicated as it
is and requires a more thorough refactor. Additionally it's not
particularly valuable to delay a transition on a loading stylesheet when
a previous commit also relied on that stylesheet but didn't wait for it
b/c it was sync. I will follow up with an improvement PR later

fixes: #27585

DiffTrain build for commit a998552.
  • Loading branch information
gnoff committed Oct 25, 2023
1 parent c5f2bb8 commit e45eec3
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24887,7 +24887,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-51ffd3564-20231025";
var ReactVersion = "18.3.0-canary-a9985529f-20231025";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9025,7 +9025,7 @@ var devToolsConfig$jscomp$inline_1032 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-51ffd3564-20231025",
version: "18.3.0-canary-a9985529f-20231025",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1225 = {
Expand Down Expand Up @@ -9056,7 +9056,7 @@ var internals$jscomp$inline_1225 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-51ffd3564-20231025"
reconcilerVersion: "18.3.0-canary-a9985529f-20231025"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1226 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9451,7 +9451,7 @@ var devToolsConfig$jscomp$inline_1074 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-51ffd3564-20231025",
version: "18.3.0-canary-a9985529f-20231025",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1266 = {
Expand Down Expand Up @@ -9482,7 +9482,7 @@ var internals$jscomp$inline_1266 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-51ffd3564-20231025"
reconcilerVersion: "18.3.0-canary-a9985529f-20231025"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1267 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-51ffd3564-20231025";
var ReactVersion = "18.3.0-canary-a9985529f-20231025";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-51ffd3564-20231025";
exports.version = "18.3.0-canary-a9985529f-20231025";
Original file line number Diff line number Diff line change
@@ -1 +1 @@
51ffd3564f97b58737df395d30628a27fa71a39d
a9985529f1aa55477f0feafe2398d36707cf6108

0 comments on commit e45eec3

Please sign in to comment.