react-server-dom-webpack 19.0.0-canary-96c584661-20240412 → 19.0.0-canary-657428a9e-20240416
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/cjs/react-server-dom-webpack-client.browser.development.js +40 -7
- package/cjs/react-server-dom-webpack-client.browser.production.js +37 -6
- package/cjs/react-server-dom-webpack-client.browser.production.min.js +7 -7
- package/cjs/react-server-dom-webpack-client.browser.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.edge.development.js +40 -7
- package/cjs/react-server-dom-webpack-client.edge.production.js +37 -6
- package/cjs/react-server-dom-webpack-client.edge.production.min.js +18 -18
- package/cjs/react-server-dom-webpack-client.edge.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.node.development.js +40 -7
- package/cjs/react-server-dom-webpack-client.node.production.js +37 -6
- package/cjs/react-server-dom-webpack-client.node.production.min.js +4 -4
- package/cjs/react-server-dom-webpack-client.node.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +40 -7
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +37 -6
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +16 -16
- package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.browser.development.js +127 -86
- package/cjs/react-server-dom-webpack-server.browser.production.js +95 -64
- package/cjs/react-server-dom-webpack-server.browser.production.min.js +59 -58
- package/cjs/react-server-dom-webpack-server.browser.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.edge.development.js +127 -86
- package/cjs/react-server-dom-webpack-server.edge.production.js +95 -64
- package/cjs/react-server-dom-webpack-server.edge.production.min.js +60 -60
- package/cjs/react-server-dom-webpack-server.edge.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.node.development.js +127 -86
- package/cjs/react-server-dom-webpack-server.node.production.js +95 -64
- package/cjs/react-server-dom-webpack-server.node.production.min.js +60 -61
- package/cjs/react-server-dom-webpack-server.node.production.min.js.map +1 -1
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +127 -86
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +95 -64
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +58 -58
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js.map +1 -1
- package/package.json +3 -3
- package/umd/react-server-dom-webpack-client.browser.development.js +40 -7
- package/umd/react-server-dom-webpack-client.browser.production.min.js +19 -19
- package/umd/react-server-dom-webpack-server.browser.development.js +127 -86
- package/umd/react-server-dom-webpack-server.browser.production.min.js +55 -54
@@ -913,7 +913,14 @@ function trackUsedThenable(thenableState, thenable, index) {
|
|
913
913
|
|
914
914
|
default:
|
915
915
|
{
|
916
|
-
if (typeof thenable.status === 'string')
|
916
|
+
if (typeof thenable.status === 'string') {
|
917
|
+
// Only instrument the thenable if the status if not defined. If
|
918
|
+
// it's defined, but an unknown value, assume it's been instrumented by
|
919
|
+
// some custom userspace implementation. We treat it as "pending".
|
920
|
+
// Attach a dummy listener, to ensure that any lazy initialization can
|
921
|
+
// happen. Flight lazily parses JSON when the value is actually awaited.
|
922
|
+
thenable.then(noop, noop);
|
923
|
+
} else {
|
917
924
|
var pendingThenable = thenable;
|
918
925
|
pendingThenable.status = 'pending';
|
919
926
|
pendingThenable.then(function (fulfilledValue) {
|
@@ -928,21 +935,22 @@ function trackUsedThenable(thenableState, thenable, index) {
|
|
928
935
|
rejectedThenable.status = 'rejected';
|
929
936
|
rejectedThenable.reason = error;
|
930
937
|
}
|
931
|
-
});
|
938
|
+
});
|
939
|
+
} // Check one more time in case the thenable resolved synchronously
|
932
940
|
|
933
|
-
switch (thenable.status) {
|
934
|
-
case 'fulfilled':
|
935
|
-
{
|
936
|
-
var fulfilledThenable = thenable;
|
937
|
-
return fulfilledThenable.value;
|
938
|
-
}
|
939
941
|
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
942
|
+
switch (thenable.status) {
|
943
|
+
case 'fulfilled':
|
944
|
+
{
|
945
|
+
var fulfilledThenable = thenable;
|
946
|
+
return fulfilledThenable.value;
|
947
|
+
}
|
948
|
+
|
949
|
+
case 'rejected':
|
950
|
+
{
|
951
|
+
var rejectedThenable = thenable;
|
952
|
+
throw rejectedThenable.reason;
|
953
|
+
}
|
946
954
|
} // Suspend.
|
947
955
|
//
|
948
956
|
// Throwing here is an implementation detail that allows us to unwind the
|
@@ -1509,6 +1517,7 @@ function createRequest(model, bundlerConfig, onError, identifierPrefix, onPostpo
|
|
1509
1517
|
nextChunkId: 0,
|
1510
1518
|
pendingChunks: 0,
|
1511
1519
|
hints: hints,
|
1520
|
+
abortListeners: new Set(),
|
1512
1521
|
abortableTasks: abortSet,
|
1513
1522
|
pingedTasks: pingedTasks,
|
1514
1523
|
completedImportChunks: [],
|
@@ -1621,10 +1630,7 @@ function serializeThenable(request, task, thenable) {
|
|
1621
1630
|
}
|
1622
1631
|
|
1623
1632
|
request.abortableTasks.delete(newTask);
|
1624
|
-
|
1625
|
-
if (request.destination !== null) {
|
1626
|
-
flushCompletedChunks(request, request.destination);
|
1627
|
-
}
|
1633
|
+
enqueueFlush(request);
|
1628
1634
|
});
|
1629
1635
|
return newTask.id;
|
1630
1636
|
}
|
@@ -1790,24 +1796,6 @@ function renderFunctionComponent(request, task, key, Component, props, owner) {
|
|
1790
1796
|
}
|
1791
1797
|
|
1792
1798
|
function renderFragment(request, task, children) {
|
1793
|
-
{
|
1794
|
-
var debugInfo = children._debugInfo;
|
1795
|
-
|
1796
|
-
if (debugInfo) {
|
1797
|
-
// If this came from Flight, forward any debug info into this new row.
|
1798
|
-
if (debugID === null) {
|
1799
|
-
// We don't have a chunk to assign debug info. We need to outline this
|
1800
|
-
// component to assign it an ID.
|
1801
|
-
return outlineTask(request, task);
|
1802
|
-
} else {
|
1803
|
-
// Forward any debug info we have the first time we see it.
|
1804
|
-
// We do this after init so that we have received all the debug info
|
1805
|
-
// from the server by the time we emit it.
|
1806
|
-
forwardDebugInfo(request, debugID, debugInfo);
|
1807
|
-
}
|
1808
|
-
}
|
1809
|
-
}
|
1810
|
-
|
1811
1799
|
if (task.keyPath !== null) {
|
1812
1800
|
// We have a Server Component that specifies a key but we're now splitting
|
1813
1801
|
// the tree using a fragment.
|
@@ -1839,6 +1827,28 @@ function renderFragment(request, task, children) {
|
|
1839
1827
|
// before recursing here.
|
1840
1828
|
|
1841
1829
|
|
1830
|
+
{
|
1831
|
+
var debugInfo = children._debugInfo;
|
1832
|
+
|
1833
|
+
if (debugInfo) {
|
1834
|
+
// If this came from Flight, forward any debug info into this new row.
|
1835
|
+
if (debugID === null) {
|
1836
|
+
// We don't have a chunk to assign debug info. We need to outline this
|
1837
|
+
// component to assign it an ID.
|
1838
|
+
return outlineTask(request, task);
|
1839
|
+
} else {
|
1840
|
+
// Forward any debug info we have the first time we see it.
|
1841
|
+
// We do this after init so that we have received all the debug info
|
1842
|
+
// from the server by the time we emit it.
|
1843
|
+
forwardDebugInfo(request, debugID, debugInfo);
|
1844
|
+
} // Since we're rendering this array again, create a copy that doesn't
|
1845
|
+
// have the debug info so we avoid outlining or emitting debug info again.
|
1846
|
+
|
1847
|
+
|
1848
|
+
children = Array.from(children);
|
1849
|
+
}
|
1850
|
+
}
|
1851
|
+
|
1842
1852
|
return children;
|
1843
1853
|
}
|
1844
1854
|
|
@@ -2180,13 +2190,9 @@ function serializeTemporaryReference(request, temporaryReference) {
|
|
2180
2190
|
}
|
2181
2191
|
|
2182
2192
|
function serializeLargeTextString(request, text) {
|
2183
|
-
request.pendingChunks
|
2193
|
+
request.pendingChunks++;
|
2184
2194
|
var textId = request.nextChunkId++;
|
2185
|
-
|
2186
|
-
var binaryLength = byteLengthOfChunk(textChunk);
|
2187
|
-
var row = textId.toString(16) + ':T' + binaryLength.toString(16) + ',';
|
2188
|
-
var headerChunk = stringToChunk(row);
|
2189
|
-
request.completedRegularChunks.push(headerChunk, textChunk);
|
2195
|
+
emitTextChunk(request, textId, text);
|
2190
2196
|
return serializeByValueID(textId);
|
2191
2197
|
}
|
2192
2198
|
|
@@ -2501,7 +2507,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2501
2507
|
|
2502
2508
|
if (iteratorFn) {
|
2503
2509
|
return renderFragment(request, task, Array.from(value));
|
2504
|
-
}
|
2510
|
+
}
|
2505
2511
|
|
2506
2512
|
|
2507
2513
|
var proto = getPrototypeOf(value);
|
@@ -2780,6 +2786,16 @@ function emitDebugChunk(request, id, debugInfo) {
|
|
2780
2786
|
request.completedRegularChunks.push(processedChunk);
|
2781
2787
|
}
|
2782
2788
|
|
2789
|
+
function emitTextChunk(request, id, text) {
|
2790
|
+
request.pendingChunks++; // Extra chunk for the header.
|
2791
|
+
|
2792
|
+
var textChunk = stringToChunk(text);
|
2793
|
+
var binaryLength = byteLengthOfChunk(textChunk);
|
2794
|
+
var row = id.toString(16) + ':T' + binaryLength.toString(16) + ',';
|
2795
|
+
var headerChunk = stringToChunk(row);
|
2796
|
+
request.completedRegularChunks.push(headerChunk, textChunk);
|
2797
|
+
}
|
2798
|
+
|
2783
2799
|
function serializeEval(source) {
|
2784
2800
|
|
2785
2801
|
return '$E' + source;
|
@@ -2979,6 +2995,22 @@ function forwardDebugInfo(request, id, debugInfo) {
|
|
2979
2995
|
}
|
2980
2996
|
}
|
2981
2997
|
|
2998
|
+
function emitChunk(request, task, value) {
|
2999
|
+
var id = task.id; // For certain types we have special types, we typically outlined them but
|
3000
|
+
// we can emit them directly for this row instead of through an indirection.
|
3001
|
+
|
3002
|
+
if (typeof value === 'string') {
|
3003
|
+
|
3004
|
+
emitTextChunk(request, id, value);
|
3005
|
+
return;
|
3006
|
+
}
|
3007
|
+
// $FlowFixMe[incompatible-type] stringify can return null for undefined but we never do
|
3008
|
+
|
3009
|
+
|
3010
|
+
var json = stringify(value, task.toJSON);
|
3011
|
+
emitModelChunk(request, task.id, json);
|
3012
|
+
}
|
3013
|
+
|
2982
3014
|
var emptyRoot = {};
|
2983
3015
|
|
2984
3016
|
function retryTask(request, task) {
|
@@ -3015,21 +3047,19 @@ function retryTask(request, task) {
|
|
3015
3047
|
|
3016
3048
|
task.keyPath = null;
|
3017
3049
|
task.implicitSlot = false;
|
3018
|
-
var json;
|
3019
3050
|
|
3020
3051
|
if (typeof resolvedModel === 'object' && resolvedModel !== null) {
|
3021
3052
|
// Object might contain unresolved values like additional elements.
|
3022
3053
|
// This is simulating what the JSON loop would do if this was part of it.
|
3023
|
-
|
3024
|
-
json = stringify(resolvedModel, task.toJSON);
|
3054
|
+
emitChunk(request, task, resolvedModel);
|
3025
3055
|
} else {
|
3026
3056
|
// If the value is a string, it means it's a terminal value and we already escaped it
|
3027
3057
|
// We don't need to escape it again so it's not passed the toJSON replacer.
|
3028
3058
|
// $FlowFixMe[incompatible-type] stringify can return null for undefined but we never do
|
3029
|
-
json = stringify(resolvedModel);
|
3059
|
+
var json = stringify(resolvedModel);
|
3060
|
+
emitModelChunk(request, task.id, json);
|
3030
3061
|
}
|
3031
3062
|
|
3032
|
-
emitModelChunk(request, task.id, json);
|
3033
3063
|
request.abortableTasks.delete(task);
|
3034
3064
|
task.status = COMPLETED;
|
3035
3065
|
} catch (thrownValue) {
|
@@ -3185,6 +3215,7 @@ function flushCompletedChunks(request, destination) {
|
|
3185
3215
|
if (request.pendingChunks === 0) {
|
3186
3216
|
|
3187
3217
|
close$1(destination);
|
3218
|
+
request.destination = null;
|
3188
3219
|
}
|
3189
3220
|
}
|
3190
3221
|
|
@@ -3246,11 +3277,10 @@ function stopFlowing(request) {
|
|
3246
3277
|
|
3247
3278
|
function abort(request, reason) {
|
3248
3279
|
try {
|
3249
|
-
var abortableTasks = request.abortableTasks;
|
3280
|
+
var abortableTasks = request.abortableTasks; // We have tasks to abort. We'll emit one error row and then emit a reference
|
3281
|
+
// to that row from every row that's still remaining.
|
3250
3282
|
|
3251
3283
|
if (abortableTasks.size > 0) {
|
3252
|
-
// We have tasks to abort. We'll emit one error row and then emit a reference
|
3253
|
-
// to that row from every row that's still remaining.
|
3254
3284
|
request.pendingChunks++;
|
3255
3285
|
var errorId = request.nextChunkId++;
|
3256
3286
|
|
@@ -3266,6 +3296,21 @@ function abort(request, reason) {
|
|
3266
3296
|
abortableTasks.clear();
|
3267
3297
|
}
|
3268
3298
|
|
3299
|
+
var abortListeners = request.abortListeners;
|
3300
|
+
|
3301
|
+
if (abortListeners.size > 0) {
|
3302
|
+
var _error;
|
3303
|
+
|
3304
|
+
if (enablePostpone && typeof reason === 'object' && reason !== null && reason.$$typeof === REACT_POSTPONE_TYPE) ; else {
|
3305
|
+
_error = reason === undefined ? new Error('The render was aborted by the server without a reason.') : reason;
|
3306
|
+
}
|
3307
|
+
|
3308
|
+
abortListeners.forEach(function (callback) {
|
3309
|
+
return callback(_error);
|
3310
|
+
});
|
3311
|
+
abortListeners.clear();
|
3312
|
+
}
|
3313
|
+
|
3269
3314
|
if (request.destination !== null) {
|
3270
3315
|
flushCompletedChunks(request, request.destination);
|
3271
3316
|
}
|
@@ -3678,7 +3723,7 @@ function getOutlinedModel(response, id) {
|
|
3678
3723
|
return chunk.value;
|
3679
3724
|
}
|
3680
3725
|
|
3681
|
-
function parseModelString(response,
|
3726
|
+
function parseModelString(response, obj, key, value) {
|
3682
3727
|
if (value[0] === '$') {
|
3683
3728
|
switch (value[1]) {
|
3684
3729
|
case '$':
|
@@ -3690,19 +3735,21 @@ function parseModelString(response, parentObject, key, value) {
|
|
3690
3735
|
case '@':
|
3691
3736
|
{
|
3692
3737
|
// Promise
|
3693
|
-
var
|
3694
|
-
|
3695
|
-
|
3738
|
+
var _id = parseInt(value.slice(2), 16);
|
3739
|
+
|
3740
|
+
var _chunk = getChunk(response, _id);
|
3741
|
+
|
3742
|
+
return _chunk;
|
3696
3743
|
}
|
3697
3744
|
|
3698
3745
|
case 'F':
|
3699
3746
|
{
|
3700
3747
|
// Server Reference
|
3701
|
-
var
|
3748
|
+
var _id2 = parseInt(value.slice(2), 16); // TODO: Just encode this in the reference inline instead of as a model.
|
3702
3749
|
|
3703
3750
|
|
3704
|
-
var metaData = getOutlinedModel(response,
|
3705
|
-
return loadServerReference$1(response, metaData.id, metaData.bound, initializingChunk,
|
3751
|
+
var metaData = getOutlinedModel(response, _id2);
|
3752
|
+
return loadServerReference$1(response, metaData.id, metaData.bound, initializingChunk, obj, key);
|
3706
3753
|
}
|
3707
3754
|
|
3708
3755
|
case 'T':
|
@@ -3714,18 +3761,18 @@ function parseModelString(response, parentObject, key, value) {
|
|
3714
3761
|
case 'Q':
|
3715
3762
|
{
|
3716
3763
|
// Map
|
3717
|
-
var
|
3764
|
+
var _id3 = parseInt(value.slice(2), 16);
|
3718
3765
|
|
3719
|
-
var data = getOutlinedModel(response,
|
3766
|
+
var data = getOutlinedModel(response, _id3);
|
3720
3767
|
return new Map(data);
|
3721
3768
|
}
|
3722
3769
|
|
3723
3770
|
case 'W':
|
3724
3771
|
{
|
3725
3772
|
// Set
|
3726
|
-
var
|
3773
|
+
var _id4 = parseInt(value.slice(2), 16);
|
3727
3774
|
|
3728
|
-
var _data = getOutlinedModel(response,
|
3775
|
+
var _data = getOutlinedModel(response, _id4);
|
3729
3776
|
|
3730
3777
|
return new Set(_data);
|
3731
3778
|
}
|
@@ -3791,37 +3838,31 @@ function parseModelString(response, parentObject, key, value) {
|
|
3791
3838
|
// BigInt
|
3792
3839
|
return BigInt(value.slice(2));
|
3793
3840
|
}
|
3841
|
+
}
|
3794
3842
|
|
3795
|
-
default:
|
3796
|
-
{
|
3797
|
-
// We assume that anything else is a reference ID.
|
3798
|
-
var _id4 = parseInt(value.slice(1), 16);
|
3799
|
-
|
3800
|
-
var _chunk = getChunk(response, _id4);
|
3801
|
-
|
3802
|
-
switch (_chunk.status) {
|
3803
|
-
case RESOLVED_MODEL:
|
3804
|
-
initializeModelChunk(_chunk);
|
3805
|
-
break;
|
3806
|
-
} // The status might have changed after initialization.
|
3807
3843
|
|
3844
|
+
var id = parseInt(value.slice(1), 16);
|
3845
|
+
var chunk = getChunk(response, id);
|
3808
3846
|
|
3809
|
-
|
3810
|
-
|
3811
|
-
|
3847
|
+
switch (chunk.status) {
|
3848
|
+
case RESOLVED_MODEL:
|
3849
|
+
initializeModelChunk(chunk);
|
3850
|
+
break;
|
3851
|
+
} // The status might have changed after initialization.
|
3812
3852
|
|
3813
|
-
case PENDING:
|
3814
|
-
case BLOCKED:
|
3815
|
-
var parentChunk = initializingChunk;
|
3816
3853
|
|
3817
|
-
|
3854
|
+
switch (chunk.status) {
|
3855
|
+
case INITIALIZED:
|
3856
|
+
return chunk.value;
|
3818
3857
|
|
3819
|
-
|
3858
|
+
case PENDING:
|
3859
|
+
case BLOCKED:
|
3860
|
+
var parentChunk = initializingChunk;
|
3861
|
+
chunk.then(createModelResolver(parentChunk, obj, key), createModelReject(parentChunk));
|
3862
|
+
return null;
|
3820
3863
|
|
3821
|
-
|
3822
|
-
|
3823
|
-
}
|
3824
|
-
}
|
3864
|
+
default:
|
3865
|
+
throw chunk.reason;
|
3825
3866
|
}
|
3826
3867
|
}
|
3827
3868
|
|
@@ -863,7 +863,14 @@ function trackUsedThenable(thenableState, thenable, index) {
|
|
863
863
|
|
864
864
|
default:
|
865
865
|
{
|
866
|
-
if (typeof thenable.status === 'string')
|
866
|
+
if (typeof thenable.status === 'string') {
|
867
|
+
// Only instrument the thenable if the status if not defined. If
|
868
|
+
// it's defined, but an unknown value, assume it's been instrumented by
|
869
|
+
// some custom userspace implementation. We treat it as "pending".
|
870
|
+
// Attach a dummy listener, to ensure that any lazy initialization can
|
871
|
+
// happen. Flight lazily parses JSON when the value is actually awaited.
|
872
|
+
thenable.then(noop, noop);
|
873
|
+
} else {
|
867
874
|
const pendingThenable = thenable;
|
868
875
|
pendingThenable.status = 'pending';
|
869
876
|
pendingThenable.then(fulfilledValue => {
|
@@ -878,21 +885,22 @@ function trackUsedThenable(thenableState, thenable, index) {
|
|
878
885
|
rejectedThenable.status = 'rejected';
|
879
886
|
rejectedThenable.reason = error;
|
880
887
|
}
|
881
|
-
});
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
888
|
+
});
|
889
|
+
} // Check one more time in case the thenable resolved synchronously
|
890
|
+
|
891
|
+
|
892
|
+
switch (thenable.status) {
|
893
|
+
case 'fulfilled':
|
894
|
+
{
|
895
|
+
const fulfilledThenable = thenable;
|
896
|
+
return fulfilledThenable.value;
|
897
|
+
}
|
898
|
+
|
899
|
+
case 'rejected':
|
900
|
+
{
|
901
|
+
const rejectedThenable = thenable;
|
902
|
+
throw rejectedThenable.reason;
|
903
|
+
}
|
896
904
|
} // Suspend.
|
897
905
|
//
|
898
906
|
// Throwing here is an implementation detail that allows us to unwind the
|
@@ -1328,6 +1336,7 @@ function createRequest(model, bundlerConfig, onError, identifierPrefix, onPostpo
|
|
1328
1336
|
nextChunkId: 0,
|
1329
1337
|
pendingChunks: 0,
|
1330
1338
|
hints,
|
1339
|
+
abortListeners: new Set(),
|
1331
1340
|
abortableTasks: abortSet,
|
1332
1341
|
pingedTasks: pingedTasks,
|
1333
1342
|
completedImportChunks: [],
|
@@ -1425,10 +1434,7 @@ function serializeThenable(request, task, thenable) {
|
|
1425
1434
|
}
|
1426
1435
|
|
1427
1436
|
request.abortableTasks.delete(newTask);
|
1428
|
-
|
1429
|
-
if (request.destination !== null) {
|
1430
|
-
flushCompletedChunks(request, request.destination);
|
1431
|
-
}
|
1437
|
+
enqueueFlush(request);
|
1432
1438
|
});
|
1433
1439
|
return newTask.id;
|
1434
1440
|
}
|
@@ -1554,7 +1560,6 @@ function renderFunctionComponent(request, task, key, Component, props, owner) {
|
|
1554
1560
|
}
|
1555
1561
|
|
1556
1562
|
function renderFragment(request, task, children) {
|
1557
|
-
|
1558
1563
|
if (task.keyPath !== null) {
|
1559
1564
|
// We have a Server Component that specifies a key but we're now splitting
|
1560
1565
|
// the tree using a fragment.
|
@@ -1581,10 +1586,6 @@ function renderFragment(request, task, children) {
|
|
1581
1586
|
|
1582
1587
|
return [fragment];
|
1583
1588
|
} // Since we're yielding here, that implicitly resets the keyPath context on the
|
1584
|
-
// way up. Which is what we want since we've consumed it. If this changes to
|
1585
|
-
// be recursive serialization, we need to reset the keyPath and implicitSlot,
|
1586
|
-
// before recursing here.
|
1587
|
-
|
1588
1589
|
|
1589
1590
|
return children;
|
1590
1591
|
}
|
@@ -1875,13 +1876,9 @@ function serializeTemporaryReference(request, temporaryReference) {
|
|
1875
1876
|
}
|
1876
1877
|
|
1877
1878
|
function serializeLargeTextString(request, text) {
|
1878
|
-
request.pendingChunks
|
1879
|
+
request.pendingChunks++;
|
1879
1880
|
const textId = request.nextChunkId++;
|
1880
|
-
|
1881
|
-
const binaryLength = byteLengthOfChunk(textChunk);
|
1882
|
-
const row = textId.toString(16) + ':T' + binaryLength.toString(16) + ',';
|
1883
|
-
const headerChunk = stringToChunk(row);
|
1884
|
-
request.completedRegularChunks.push(headerChunk, textChunk);
|
1881
|
+
emitTextChunk(request, textId, text);
|
1885
1882
|
return serializeByValueID(textId);
|
1886
1883
|
}
|
1887
1884
|
|
@@ -2158,7 +2155,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2158
2155
|
|
2159
2156
|
if (iteratorFn) {
|
2160
2157
|
return renderFragment(request, task, Array.from(value));
|
2161
|
-
}
|
2158
|
+
}
|
2162
2159
|
|
2163
2160
|
|
2164
2161
|
const proto = getPrototypeOf(value);
|
@@ -2367,6 +2364,32 @@ function emitModelChunk(request, id, json) {
|
|
2367
2364
|
request.completedRegularChunks.push(processedChunk);
|
2368
2365
|
}
|
2369
2366
|
|
2367
|
+
function emitTextChunk(request, id, text) {
|
2368
|
+
request.pendingChunks++; // Extra chunk for the header.
|
2369
|
+
|
2370
|
+
const textChunk = stringToChunk(text);
|
2371
|
+
const binaryLength = byteLengthOfChunk(textChunk);
|
2372
|
+
const row = id.toString(16) + ':T' + binaryLength.toString(16) + ',';
|
2373
|
+
const headerChunk = stringToChunk(row);
|
2374
|
+
request.completedRegularChunks.push(headerChunk, textChunk);
|
2375
|
+
}
|
2376
|
+
|
2377
|
+
function emitChunk(request, task, value) {
|
2378
|
+
const id = task.id; // For certain types we have special types, we typically outlined them but
|
2379
|
+
// we can emit them directly for this row instead of through an indirection.
|
2380
|
+
|
2381
|
+
if (typeof value === 'string') {
|
2382
|
+
|
2383
|
+
emitTextChunk(request, id, value);
|
2384
|
+
return;
|
2385
|
+
}
|
2386
|
+
// $FlowFixMe[incompatible-type] stringify can return null for undefined but we never do
|
2387
|
+
|
2388
|
+
|
2389
|
+
const json = stringify(value, task.toJSON);
|
2390
|
+
emitModelChunk(request, task.id, json);
|
2391
|
+
}
|
2392
|
+
|
2370
2393
|
const emptyRoot = {};
|
2371
2394
|
|
2372
2395
|
function retryTask(request, task) {
|
@@ -2394,21 +2417,19 @@ function retryTask(request, task) {
|
|
2394
2417
|
|
2395
2418
|
task.keyPath = null;
|
2396
2419
|
task.implicitSlot = false;
|
2397
|
-
let json;
|
2398
2420
|
|
2399
2421
|
if (typeof resolvedModel === 'object' && resolvedModel !== null) {
|
2400
2422
|
// Object might contain unresolved values like additional elements.
|
2401
2423
|
// This is simulating what the JSON loop would do if this was part of it.
|
2402
|
-
|
2403
|
-
json = stringify(resolvedModel, task.toJSON);
|
2424
|
+
emitChunk(request, task, resolvedModel);
|
2404
2425
|
} else {
|
2405
2426
|
// If the value is a string, it means it's a terminal value and we already escaped it
|
2406
2427
|
// We don't need to escape it again so it's not passed the toJSON replacer.
|
2407
2428
|
// $FlowFixMe[incompatible-type] stringify can return null for undefined but we never do
|
2408
|
-
json = stringify(resolvedModel);
|
2429
|
+
const json = stringify(resolvedModel);
|
2430
|
+
emitModelChunk(request, task.id, json);
|
2409
2431
|
}
|
2410
2432
|
|
2411
|
-
emitModelChunk(request, task.id, json);
|
2412
2433
|
request.abortableTasks.delete(task);
|
2413
2434
|
task.status = COMPLETED;
|
2414
2435
|
} catch (thrownValue) {
|
@@ -2542,6 +2563,7 @@ function flushCompletedChunks(request, destination) {
|
|
2542
2563
|
if (request.pendingChunks === 0) {
|
2543
2564
|
|
2544
2565
|
close$1(destination);
|
2566
|
+
request.destination = null;
|
2545
2567
|
}
|
2546
2568
|
}
|
2547
2569
|
|
@@ -2597,11 +2619,10 @@ function stopFlowing(request) {
|
|
2597
2619
|
|
2598
2620
|
function abort(request, reason) {
|
2599
2621
|
try {
|
2600
|
-
const abortableTasks = request.abortableTasks;
|
2622
|
+
const abortableTasks = request.abortableTasks; // We have tasks to abort. We'll emit one error row and then emit a reference
|
2623
|
+
// to that row from every row that's still remaining.
|
2601
2624
|
|
2602
2625
|
if (abortableTasks.size > 0) {
|
2603
|
-
// We have tasks to abort. We'll emit one error row and then emit a reference
|
2604
|
-
// to that row from every row that's still remaining.
|
2605
2626
|
request.pendingChunks++;
|
2606
2627
|
const errorId = request.nextChunkId++;
|
2607
2628
|
|
@@ -2615,6 +2636,19 @@ function abort(request, reason) {
|
|
2615
2636
|
abortableTasks.clear();
|
2616
2637
|
}
|
2617
2638
|
|
2639
|
+
const abortListeners = request.abortListeners;
|
2640
|
+
|
2641
|
+
if (abortListeners.size > 0) {
|
2642
|
+
let error;
|
2643
|
+
|
2644
|
+
if (enablePostpone && typeof reason === 'object' && reason !== null && reason.$$typeof === REACT_POSTPONE_TYPE) ; else {
|
2645
|
+
error = reason === undefined ? new Error('The render was aborted by the server without a reason.') : reason;
|
2646
|
+
}
|
2647
|
+
|
2648
|
+
abortListeners.forEach(callback => callback(error));
|
2649
|
+
abortListeners.clear();
|
2650
|
+
}
|
2651
|
+
|
2618
2652
|
if (request.destination !== null) {
|
2619
2653
|
flushCompletedChunks(request, request.destination);
|
2620
2654
|
}
|
@@ -3023,7 +3057,7 @@ function getOutlinedModel(response, id) {
|
|
3023
3057
|
return chunk.value;
|
3024
3058
|
}
|
3025
3059
|
|
3026
|
-
function parseModelString(response,
|
3060
|
+
function parseModelString(response, obj, key, value) {
|
3027
3061
|
if (value[0] === '$') {
|
3028
3062
|
switch (value[1]) {
|
3029
3063
|
case '$':
|
@@ -3046,7 +3080,7 @@ function parseModelString(response, parentObject, key, value) {
|
|
3046
3080
|
const id = parseInt(value.slice(2), 16); // TODO: Just encode this in the reference inline instead of as a model.
|
3047
3081
|
|
3048
3082
|
const metaData = getOutlinedModel(response, id);
|
3049
|
-
return loadServerReference$1(response, metaData.id, metaData.bound, initializingChunk,
|
3083
|
+
return loadServerReference$1(response, metaData.id, metaData.bound, initializingChunk, obj, key);
|
3050
3084
|
}
|
3051
3085
|
|
3052
3086
|
case 'T':
|
@@ -3130,34 +3164,31 @@ function parseModelString(response, parentObject, key, value) {
|
|
3130
3164
|
// BigInt
|
3131
3165
|
return BigInt(value.slice(2));
|
3132
3166
|
}
|
3167
|
+
}
|
3133
3168
|
|
3134
|
-
default:
|
3135
|
-
{
|
3136
|
-
// We assume that anything else is a reference ID.
|
3137
|
-
const id = parseInt(value.slice(1), 16);
|
3138
|
-
const chunk = getChunk(response, id);
|
3139
3169
|
|
3140
|
-
|
3141
|
-
|
3142
|
-
initializeModelChunk(chunk);
|
3143
|
-
break;
|
3144
|
-
} // The status might have changed after initialization.
|
3170
|
+
const id = parseInt(value.slice(1), 16);
|
3171
|
+
const chunk = getChunk(response, id);
|
3145
3172
|
|
3173
|
+
switch (chunk.status) {
|
3174
|
+
case RESOLVED_MODEL:
|
3175
|
+
initializeModelChunk(chunk);
|
3176
|
+
break;
|
3177
|
+
} // The status might have changed after initialization.
|
3146
3178
|
|
3147
|
-
switch (chunk.status) {
|
3148
|
-
case INITIALIZED:
|
3149
|
-
return chunk.value;
|
3150
3179
|
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
chunk.then(createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk));
|
3155
|
-
return null;
|
3180
|
+
switch (chunk.status) {
|
3181
|
+
case INITIALIZED:
|
3182
|
+
return chunk.value;
|
3156
3183
|
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3184
|
+
case PENDING:
|
3185
|
+
case BLOCKED:
|
3186
|
+
const parentChunk = initializingChunk;
|
3187
|
+
chunk.then(createModelResolver(parentChunk, obj, key), createModelReject(parentChunk));
|
3188
|
+
return null;
|
3189
|
+
|
3190
|
+
default:
|
3191
|
+
throw chunk.reason;
|
3161
3192
|
}
|
3162
3193
|
}
|
3163
3194
|
|