You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Render children passed to "backwards" SuspenseList in reverse mount order (#35021)
Stacked on #35018.
This mounts the children of SuspenseList backwards. Meaning the first
child is mounted last in the DOM (and effect list). It's like calling
reverse() on the children.
This is meant to set us up for allowing AsyncIterable children where the
unknown number of children streams in at the end (which is the beginning
in a backwards SuspenseList). For consistency we do that with other
children too.
`unstable_legacy-backwards` still exists for the old mode but is meant
to be deprecated.
<img width="100" alt="image"
src="https://github.com/user-attachments/assets/5c2a95d7-34c4-4a4e-b602-3646a834d779"
/>
DiffTrain build for [488d88b](488d88b)
Copy file name to clipboardExpand all lines: compiled/facebook-www/ReactART-dev.classic.js
+59-30Lines changed: 59 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -9055,6 +9055,16 @@ __DEV__ &&
9055
9055
propagationRoot
9056
9056
);
9057
9057
}
9058
+
function findLastContentRow(firstChild) {
9059
+
for (var lastContentRow = null; null !== firstChild; ) {
9060
+
var currentRow = firstChild.alternate;
9061
+
null !== currentRow &&
9062
+
null === findFirstSuspended(currentRow) &&
9063
+
(lastContentRow = firstChild);
9064
+
firstChild = firstChild.sibling;
9065
+
}
9066
+
return lastContentRow;
9067
+
}
9058
9068
function initSuspenseListRenderState(
9059
9069
workInProgress,
9060
9070
isBackwards,
@@ -9082,6 +9092,15 @@ __DEV__ &&
9082
9092
(renderState.tailMode = tailMode),
9083
9093
(renderState.treeForkCount = treeForkCount));
9084
9094
}
9095
+
function reverseChildren(fiber) {
9096
+
var row = fiber.child;
9097
+
for (fiber.child = null; null !== row; ) {
9098
+
var nextRow = row.sibling;
9099
+
row.sibling = fiber.child;
9100
+
fiber.child = row;
9101
+
row = nextRow;
9102
+
}
9103
+
}
9085
9104
function updateSuspenseListComponent(current, workInProgress, renderLanes) {
9086
9105
var nextProps = workInProgress.pendingProps,
9087
9106
revealOrder = nextProps.revealOrder,
@@ -9100,19 +9119,16 @@ __DEV__ &&
9100
9119
if (
9101
9120
null != revealOrder &&
9102
9121
"forwards" !== revealOrder &&
9122
+
"backwards" !== revealOrder &&
9103
9123
"unstable_legacy-backwards" !== revealOrder &&
9104
9124
"together" !== revealOrder &&
9105
9125
"independent" !== revealOrder &&
9106
9126
!didWarnAboutRevealOrder[suspenseContext]
9107
9127
)
9108
9128
if (
9109
9129
((didWarnAboutRevealOrder[suspenseContext] = !0),
9110
-
"backwards" === revealOrder)
9130
+
"string" === typeof revealOrder)
9111
9131
)
9112
-
console.error(
9113
-
'The rendering order of <SuspenseList revealOrder="backwards"> is changing. To be future compatible you must specify revealOrder="legacy_unstable-backwards" instead.'
9114
-
);
9115
-
else if ("string" === typeof revealOrder)
9116
9132
switch (revealOrder.toLowerCase()) {
9117
9133
case "together":
9118
9134
case "forwards":
@@ -9204,7 +9220,11 @@ __DEV__ &&
9204
9220
'A single row was passed to a <SuspenseList revealOrder="%s" />. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?',
Copy file name to clipboardExpand all lines: compiled/facebook-www/ReactART-dev.modern.js
+59-30Lines changed: 59 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -8886,6 +8886,16 @@ __DEV__ &&
8886
8886
propagationRoot
8887
8887
);
8888
8888
}
8889
+
function findLastContentRow(firstChild) {
8890
+
for (var lastContentRow = null; null !== firstChild; ) {
8891
+
var currentRow = firstChild.alternate;
8892
+
null !== currentRow &&
8893
+
null === findFirstSuspended(currentRow) &&
8894
+
(lastContentRow = firstChild);
8895
+
firstChild = firstChild.sibling;
8896
+
}
8897
+
return lastContentRow;
8898
+
}
8889
8899
function initSuspenseListRenderState(
8890
8900
workInProgress,
8891
8901
isBackwards,
@@ -8913,6 +8923,15 @@ __DEV__ &&
8913
8923
(renderState.tailMode = tailMode),
8914
8924
(renderState.treeForkCount = treeForkCount));
8915
8925
}
8926
+
function reverseChildren(fiber) {
8927
+
var row = fiber.child;
8928
+
for (fiber.child = null; null !== row; ) {
8929
+
var nextRow = row.sibling;
8930
+
row.sibling = fiber.child;
8931
+
fiber.child = row;
8932
+
row = nextRow;
8933
+
}
8934
+
}
8916
8935
function updateSuspenseListComponent(current, workInProgress, renderLanes) {
8917
8936
var nextProps = workInProgress.pendingProps,
8918
8937
revealOrder = nextProps.revealOrder,
@@ -8931,19 +8950,16 @@ __DEV__ &&
8931
8950
if (
8932
8951
null != revealOrder &&
8933
8952
"forwards" !== revealOrder &&
8953
+
"backwards" !== revealOrder &&
8934
8954
"unstable_legacy-backwards" !== revealOrder &&
8935
8955
"together" !== revealOrder &&
8936
8956
"independent" !== revealOrder &&
8937
8957
!didWarnAboutRevealOrder[suspenseContext]
8938
8958
)
8939
8959
if (
8940
8960
((didWarnAboutRevealOrder[suspenseContext] = !0),
8941
-
"backwards" === revealOrder)
8961
+
"string" === typeof revealOrder)
8942
8962
)
8943
-
console.error(
8944
-
'The rendering order of <SuspenseList revealOrder="backwards"> is changing. To be future compatible you must specify revealOrder="legacy_unstable-backwards" instead.'
8945
-
);
8946
-
else if ("string" === typeof revealOrder)
8947
8963
switch (revealOrder.toLowerCase()) {
8948
8964
case "together":
8949
8965
case "forwards":
@@ -9035,7 +9051,11 @@ __DEV__ &&
9035
9051
'A single row was passed to a <SuspenseList revealOrder="%s" />. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?',
0 commit comments