Skip to content

Commit 15fefa1

Browse files
committed
Revert "[Flight] Serialize deduped elements by direct reference even if they suspend (#28283)"
This reverts commit ba5e6a8.
1 parent d5cbcd6 commit 15fefa1

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

packages/react-server/src/ReactFlightServer.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,16 +1334,12 @@ function renderModelDestructive(
13341334
// but that is able to reuse the same task if we're already in one but then that
13351335
// will be a lazy future value rather than guaranteed to exist but maybe that's good.
13361336
const newId = outlineModel(request, (value: any));
1337-
return serializeByValueID(newId);
1337+
return serializeLazyID(newId);
13381338
} else {
13391339
// We've already emitted this as an outlined object, so we can refer to that by its
1340-
// existing ID. TODO: We should use a lazy reference since, unlike plain objects,
1341-
// elements might suspend so it might not have emitted yet even if we have the ID for
1342-
// it. However, this creates an extra wrapper when it's not needed. We should really
1343-
// detect whether this already was emitted and synchronously available. In that
1344-
// case we can refer to it synchronously and only make it lazy otherwise.
1345-
// We currently don't have a data structure that lets us see that though.
1346-
return serializeByValueID(existingId);
1340+
// existing ID. We use a lazy reference since, unlike plain objects, elements might
1341+
// suspend so it might not have emitted yet even if we have the ID for it.
1342+
return serializeLazyID(existingId);
13471343
}
13481344
} else {
13491345
// This is the first time we've seen this object. We may never see it again

0 commit comments

Comments
 (0)