[Flight] Don't dedupe references to deferred objects (#33741)

If we're about to defer an object, then we shouldn't store a reference
to it because then we can end up deduping by referring to the deferred
string. If in a different context, we should still be able to emit the
object.
This commit is contained in:
Sebastian Markbåge 2025-07-08 21:47:33 -04:00 committed by GitHub
parent 956d770adf
commit 8ba3501cd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4345,6 +4345,12 @@ function renderDebugModel(
if (parentReference !== undefined) { if (parentReference !== undefined) {
// If the parent has a reference, we can refer to this object indirectly // If the parent has a reference, we can refer to this object indirectly
// through the property name inside that parent. // through the property name inside that parent.
if (counter.objectLimit <= 0 && !doNotLimit.has(value)) {
// If we are going to defer this, don't dedupe it since then we'd dedupe it to be
// deferred in future reference.
return serializeDeferredObject(request, value);
}
let propertyName = parentPropertyName; let propertyName = parentPropertyName;
if (isArray(parent) && parent[0] === REACT_ELEMENT_TYPE) { if (isArray(parent) && parent[0] === REACT_ELEMENT_TYPE) {
// For elements, we've converted it to an array but we'll have converted // For elements, we've converted it to an array but we'll have converted