react-server-dom-webpack 19.0.0-beta-b498834eab-20240506 → 19.0.0-beta-6946ebe620-20240508
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-server.browser.development.js +57 -57
- package/cjs/react-server-dom-webpack-server.browser.production.js +63 -47
- package/cjs/react-server-dom-webpack-server.edge.development.js +57 -57
- package/cjs/react-server-dom-webpack-server.edge.production.js +63 -47
- package/cjs/react-server-dom-webpack-server.node.development.js +57 -57
- package/cjs/react-server-dom-webpack-server.node.production.js +66 -50
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +57 -57
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +66 -50
- package/package.json +3 -3
@@ -1905,9 +1905,8 @@ function renderFragment(request, task, children) {
|
|
1905
1905
|
|
1906
1906
|
function renderClientElement(task, type, key, props, owner) // DEV-only
|
1907
1907
|
{
|
1908
|
+
// We prepend the terminal client element that actually gets serialized with
|
1908
1909
|
// the keys of any Server Components which are not serialized.
|
1909
|
-
|
1910
|
-
|
1911
1910
|
var keyPath = task.keyPath;
|
1912
1911
|
|
1913
1912
|
if (key === null) {
|
@@ -2051,7 +2050,7 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
|
2051
2050
|
if (typeof model === 'object' && model !== null) {
|
2052
2051
|
// If we're about to write this into a new task we can assign it an ID early so that
|
2053
2052
|
// any other references can refer to the value we're about to write.
|
2054
|
-
if (
|
2053
|
+
if (keyPath !== null || implicitSlot) ; else {
|
2055
2054
|
request.writtenObjects.set(model, id);
|
2056
2055
|
}
|
2057
2056
|
}
|
@@ -2393,7 +2392,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2393
2392
|
var _existingId = _writtenObjects.get(value);
|
2394
2393
|
|
2395
2394
|
if (_existingId !== undefined) {
|
2396
|
-
if (
|
2395
|
+
if (task.keyPath !== null || task.implicitSlot) ; else if (modelRoot === value) {
|
2397
2396
|
// This is the ID we're currently emitting so we need to write it
|
2398
2397
|
// once but if we discover it again, we refer to it by id.
|
2399
2398
|
modelRoot = null;
|
@@ -2498,7 +2497,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2498
2497
|
|
2499
2498
|
if (typeof value.then === 'function') {
|
2500
2499
|
if (existingId !== undefined) {
|
2501
|
-
if (
|
2500
|
+
if (task.keyPath !== null || task.implicitSlot) {
|
2502
2501
|
// If we're in some kind of context we can't reuse the result of this render or
|
2503
2502
|
// previous renders of this element. We only reuse Promises if they're not wrapped
|
2504
2503
|
// by another Server Component.
|
@@ -3663,7 +3662,7 @@ function loadServerReference$1(response, id, bound, parentChunk, parentObject, k
|
|
3663
3662
|
}
|
3664
3663
|
}
|
3665
3664
|
|
3666
|
-
promise.then(createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk)); // We need a placeholder value that will be replaced later.
|
3665
|
+
promise.then(createModelResolver(parentChunk, parentObject, key, false, response, createModel), createModelReject(parentChunk)); // We need a placeholder value that will be replaced later.
|
3667
3666
|
|
3668
3667
|
return null;
|
3669
3668
|
}
|
@@ -3740,21 +3739,24 @@ function getChunk(response, id) {
|
|
3740
3739
|
return chunk;
|
3741
3740
|
}
|
3742
3741
|
|
3743
|
-
function createModelResolver(chunk, parentObject, key) {
|
3742
|
+
function createModelResolver(chunk, parentObject, key, cyclic, response, map) {
|
3744
3743
|
var blocked;
|
3745
3744
|
|
3746
3745
|
if (initializingChunkBlockedModel) {
|
3747
3746
|
blocked = initializingChunkBlockedModel;
|
3748
|
-
|
3747
|
+
|
3748
|
+
if (!cyclic) {
|
3749
|
+
blocked.deps++;
|
3750
|
+
}
|
3749
3751
|
} else {
|
3750
3752
|
blocked = initializingChunkBlockedModel = {
|
3751
|
-
deps: 1,
|
3753
|
+
deps: cyclic ? 0 : 1,
|
3752
3754
|
value: null
|
3753
3755
|
};
|
3754
3756
|
}
|
3755
3757
|
|
3756
3758
|
return function (value) {
|
3757
|
-
parentObject[key] = value; // If this is the root object for a model reference, where `blocked.value`
|
3759
|
+
parentObject[key] = map(response, value); // If this is the root object for a model reference, where `blocked.value`
|
3758
3760
|
// is a stale `null`, the resolved value can be used directly.
|
3759
3761
|
|
3760
3762
|
if (key === '' && blocked.value === null) {
|
@@ -3786,19 +3788,46 @@ function createModelReject(chunk) {
|
|
3786
3788
|
};
|
3787
3789
|
}
|
3788
3790
|
|
3789
|
-
function getOutlinedModel(response, id) {
|
3791
|
+
function getOutlinedModel(response, id, parentObject, key, map) {
|
3790
3792
|
var chunk = getChunk(response, id);
|
3791
3793
|
|
3792
|
-
|
3793
|
-
|
3794
|
-
|
3794
|
+
switch (chunk.status) {
|
3795
|
+
case RESOLVED_MODEL:
|
3796
|
+
initializeModelChunk(chunk);
|
3797
|
+
break;
|
3798
|
+
} // The status might have changed after initialization.
|
3795
3799
|
|
3796
|
-
|
3797
|
-
|
3798
|
-
|
3800
|
+
|
3801
|
+
switch (chunk.status) {
|
3802
|
+
case INITIALIZED:
|
3803
|
+
return map(response, chunk.value);
|
3804
|
+
|
3805
|
+
case PENDING:
|
3806
|
+
case BLOCKED:
|
3807
|
+
var parentChunk = initializingChunk;
|
3808
|
+
chunk.then(createModelResolver(parentChunk, parentObject, key, false, response, map), createModelReject(parentChunk));
|
3809
|
+
return null;
|
3810
|
+
|
3811
|
+
default:
|
3812
|
+
throw chunk.reason;
|
3799
3813
|
}
|
3814
|
+
}
|
3815
|
+
|
3816
|
+
function createMap(response, model) {
|
3817
|
+
return new Map(model);
|
3818
|
+
}
|
3819
|
+
|
3820
|
+
function createSet(response, model) {
|
3821
|
+
return new Set(model);
|
3822
|
+
}
|
3800
3823
|
|
3801
|
-
|
3824
|
+
function extractIterator(response, model) {
|
3825
|
+
// $FlowFixMe[incompatible-use]: This uses raw Symbols because we're extracting from a native array.
|
3826
|
+
return model[Symbol.iterator]();
|
3827
|
+
}
|
3828
|
+
|
3829
|
+
function createModel(response, model) {
|
3830
|
+
return model;
|
3802
3831
|
}
|
3803
3832
|
|
3804
3833
|
function parseModelString(response, obj, key, value) {
|
@@ -3815,9 +3844,8 @@ function parseModelString(response, obj, key, value) {
|
|
3815
3844
|
// Promise
|
3816
3845
|
var _id = parseInt(value.slice(2), 16);
|
3817
3846
|
|
3818
|
-
var
|
3819
|
-
|
3820
|
-
return _chunk2;
|
3847
|
+
var chunk = getChunk(response, _id);
|
3848
|
+
return chunk;
|
3821
3849
|
}
|
3822
3850
|
|
3823
3851
|
case 'F':
|
@@ -3826,7 +3854,7 @@ function parseModelString(response, obj, key, value) {
|
|
3826
3854
|
var _id2 = parseInt(value.slice(2), 16); // TODO: Just encode this in the reference inline instead of as a model.
|
3827
3855
|
|
3828
3856
|
|
3829
|
-
var metaData = getOutlinedModel(response, _id2);
|
3857
|
+
var metaData = getOutlinedModel(response, _id2, obj, key, createModel);
|
3830
3858
|
return loadServerReference$1(response, metaData.id, metaData.bound, initializingChunk, obj, key);
|
3831
3859
|
}
|
3832
3860
|
|
@@ -3841,8 +3869,7 @@ function parseModelString(response, obj, key, value) {
|
|
3841
3869
|
// Map
|
3842
3870
|
var _id3 = parseInt(value.slice(2), 16);
|
3843
3871
|
|
3844
|
-
|
3845
|
-
return new Map(data);
|
3872
|
+
return getOutlinedModel(response, _id3, obj, key, createMap);
|
3846
3873
|
}
|
3847
3874
|
|
3848
3875
|
case 'W':
|
@@ -3850,9 +3877,7 @@ function parseModelString(response, obj, key, value) {
|
|
3850
3877
|
// Set
|
3851
3878
|
var _id4 = parseInt(value.slice(2), 16);
|
3852
3879
|
|
3853
|
-
|
3854
|
-
|
3855
|
-
return new Set(_data);
|
3880
|
+
return getOutlinedModel(response, _id4, obj, key, createSet);
|
3856
3881
|
}
|
3857
3882
|
|
3858
3883
|
case 'K':
|
@@ -3860,9 +3885,7 @@ function parseModelString(response, obj, key, value) {
|
|
3860
3885
|
// FormData
|
3861
3886
|
var stringId = value.slice(2);
|
3862
3887
|
var formPrefix = response._prefix + stringId + '_';
|
3863
|
-
|
3864
|
-
var _data2 = new FormData();
|
3865
|
-
|
3888
|
+
var data = new FormData();
|
3866
3889
|
var backingFormData = response._formData; // We assume that the reference to FormData always comes after each
|
3867
3890
|
// entry that it references so we can assume they all exist in the
|
3868
3891
|
// backing store already.
|
@@ -3870,10 +3893,10 @@ function parseModelString(response, obj, key, value) {
|
|
3870
3893
|
|
3871
3894
|
backingFormData.forEach(function (entry, entryKey) {
|
3872
3895
|
if (entryKey.startsWith(formPrefix)) {
|
3873
|
-
|
3896
|
+
data.append(entryKey.slice(formPrefix.length), entry);
|
3874
3897
|
}
|
3875
3898
|
});
|
3876
|
-
return
|
3899
|
+
return data;
|
3877
3900
|
}
|
3878
3901
|
|
3879
3902
|
case 'i':
|
@@ -3881,9 +3904,7 @@ function parseModelString(response, obj, key, value) {
|
|
3881
3904
|
// Iterator
|
3882
3905
|
var _id5 = parseInt(value.slice(2), 16);
|
3883
3906
|
|
3884
|
-
|
3885
|
-
|
3886
|
-
return _data3[Symbol.iterator]();
|
3907
|
+
return getOutlinedModel(response, _id5, obj, key, extractIterator);
|
3887
3908
|
}
|
3888
3909
|
|
3889
3910
|
case 'I':
|
@@ -3930,28 +3951,7 @@ function parseModelString(response, obj, key, value) {
|
|
3930
3951
|
|
3931
3952
|
|
3932
3953
|
var id = parseInt(value.slice(1), 16);
|
3933
|
-
|
3934
|
-
|
3935
|
-
switch (chunk.status) {
|
3936
|
-
case RESOLVED_MODEL:
|
3937
|
-
initializeModelChunk(chunk);
|
3938
|
-
break;
|
3939
|
-
} // The status might have changed after initialization.
|
3940
|
-
|
3941
|
-
|
3942
|
-
switch (chunk.status) {
|
3943
|
-
case INITIALIZED:
|
3944
|
-
return chunk.value;
|
3945
|
-
|
3946
|
-
case PENDING:
|
3947
|
-
case BLOCKED:
|
3948
|
-
var parentChunk = initializingChunk;
|
3949
|
-
chunk.then(createModelResolver(parentChunk, obj, key), createModelReject(parentChunk));
|
3950
|
-
return null;
|
3951
|
-
|
3952
|
-
default:
|
3953
|
-
throw chunk.reason;
|
3954
|
-
}
|
3954
|
+
return getOutlinedModel(response, id, obj, key, createModel);
|
3955
3955
|
}
|
3956
3956
|
|
3957
3957
|
return value;
|
@@ -1597,20 +1597,27 @@ function loadServerReference$1(
|
|
1597
1597
|
key
|
1598
1598
|
) {
|
1599
1599
|
var serverReference = resolveServerReference(response._bundlerConfig, id);
|
1600
|
-
|
1600
|
+
id = preloadModule(serverReference);
|
1601
1601
|
if (bound)
|
1602
|
-
bound = Promise.all([bound,
|
1602
|
+
bound = Promise.all([bound, id]).then(function (_ref) {
|
1603
1603
|
_ref = _ref[0];
|
1604
1604
|
var fn = requireModule(serverReference);
|
1605
1605
|
return fn.bind.apply(fn, [null].concat(_ref));
|
1606
1606
|
});
|
1607
|
-
else if (
|
1608
|
-
bound = Promise.resolve(
|
1607
|
+
else if (id)
|
1608
|
+
bound = Promise.resolve(id).then(function () {
|
1609
1609
|
return requireModule(serverReference);
|
1610
1610
|
});
|
1611
1611
|
else return requireModule(serverReference);
|
1612
1612
|
bound.then(
|
1613
|
-
createModelResolver(
|
1613
|
+
createModelResolver(
|
1614
|
+
parentChunk,
|
1615
|
+
parentObject,
|
1616
|
+
key,
|
1617
|
+
!1,
|
1618
|
+
response,
|
1619
|
+
createModel
|
1620
|
+
),
|
1614
1621
|
createModelReject(parentChunk)
|
1615
1622
|
);
|
1616
1623
|
return null;
|
@@ -1655,13 +1662,17 @@ function getChunk(response, id) {
|
|
1655
1662
|
chunks.set(id, chunk));
|
1656
1663
|
return chunk;
|
1657
1664
|
}
|
1658
|
-
function createModelResolver(chunk, parentObject, key) {
|
1665
|
+
function createModelResolver(chunk, parentObject, key, cyclic, response, map) {
|
1659
1666
|
if (initializingChunkBlockedModel) {
|
1660
1667
|
var blocked = initializingChunkBlockedModel;
|
1661
|
-
blocked.deps++;
|
1662
|
-
} else
|
1668
|
+
cyclic || blocked.deps++;
|
1669
|
+
} else
|
1670
|
+
blocked = initializingChunkBlockedModel = {
|
1671
|
+
deps: cyclic ? 0 : 1,
|
1672
|
+
value: null
|
1673
|
+
};
|
1663
1674
|
return function (value) {
|
1664
|
-
parentObject[key] = value;
|
1675
|
+
parentObject[key] = map(response, value);
|
1665
1676
|
"" === key && null === blocked.value && (blocked.value = parentObject[key]);
|
1666
1677
|
blocked.deps--;
|
1667
1678
|
0 === blocked.deps &&
|
@@ -1677,11 +1688,38 @@ function createModelReject(chunk) {
|
|
1677
1688
|
return triggerErrorOnChunk(chunk, error);
|
1678
1689
|
};
|
1679
1690
|
}
|
1680
|
-
function getOutlinedModel(response, id) {
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1691
|
+
function getOutlinedModel(response, id, parentObject, key, map) {
|
1692
|
+
id = getChunk(response, id);
|
1693
|
+
switch (id.status) {
|
1694
|
+
case "resolved_model":
|
1695
|
+
initializeModelChunk(id);
|
1696
|
+
}
|
1697
|
+
switch (id.status) {
|
1698
|
+
case "fulfilled":
|
1699
|
+
return map(response, id.value);
|
1700
|
+
case "pending":
|
1701
|
+
case "blocked":
|
1702
|
+
var parentChunk = initializingChunk;
|
1703
|
+
id.then(
|
1704
|
+
createModelResolver(parentChunk, parentObject, key, !1, response, map),
|
1705
|
+
createModelReject(parentChunk)
|
1706
|
+
);
|
1707
|
+
return null;
|
1708
|
+
default:
|
1709
|
+
throw id.reason;
|
1710
|
+
}
|
1711
|
+
}
|
1712
|
+
function createMap(response, model) {
|
1713
|
+
return new Map(model);
|
1714
|
+
}
|
1715
|
+
function createSet(response, model) {
|
1716
|
+
return new Set(model);
|
1717
|
+
}
|
1718
|
+
function extractIterator(response, model) {
|
1719
|
+
return model[Symbol.iterator]();
|
1720
|
+
}
|
1721
|
+
function createModel(response, model) {
|
1722
|
+
return model;
|
1685
1723
|
}
|
1686
1724
|
function parseModelString(response, obj, key, value) {
|
1687
1725
|
if ("$" === value[0]) {
|
@@ -1693,7 +1731,7 @@ function parseModelString(response, obj, key, value) {
|
|
1693
1731
|
case "F":
|
1694
1732
|
return (
|
1695
1733
|
(value = parseInt(value.slice(2), 16)),
|
1696
|
-
(value = getOutlinedModel(response, value)),
|
1734
|
+
(value = getOutlinedModel(response, value, obj, key, createModel)),
|
1697
1735
|
loadServerReference$1(
|
1698
1736
|
response,
|
1699
1737
|
value.id,
|
@@ -1707,29 +1745,27 @@ function parseModelString(response, obj, key, value) {
|
|
1707
1745
|
return createTemporaryReference(value.slice(2));
|
1708
1746
|
case "Q":
|
1709
1747
|
return (
|
1710
|
-
(
|
1711
|
-
(response
|
1712
|
-
new Map(response)
|
1748
|
+
(value = parseInt(value.slice(2), 16)),
|
1749
|
+
getOutlinedModel(response, value, obj, key, createMap)
|
1713
1750
|
);
|
1714
1751
|
case "W":
|
1715
1752
|
return (
|
1716
|
-
(
|
1717
|
-
(response
|
1718
|
-
new Set(response)
|
1753
|
+
(value = parseInt(value.slice(2), 16)),
|
1754
|
+
getOutlinedModel(response, value, obj, key, createSet)
|
1719
1755
|
);
|
1720
1756
|
case "K":
|
1721
1757
|
obj = value.slice(2);
|
1722
1758
|
var formPrefix = response._prefix + obj + "_",
|
1723
|
-
data
|
1759
|
+
data = new FormData();
|
1724
1760
|
response._formData.forEach(function (entry, entryKey) {
|
1725
1761
|
entryKey.startsWith(formPrefix) &&
|
1726
|
-
data
|
1762
|
+
data.append(entryKey.slice(formPrefix.length), entry);
|
1727
1763
|
});
|
1728
|
-
return data
|
1764
|
+
return data;
|
1729
1765
|
case "i":
|
1730
1766
|
return (
|
1731
|
-
(
|
1732
|
-
getOutlinedModel(response, obj)
|
1767
|
+
(value = parseInt(value.slice(2), 16)),
|
1768
|
+
getOutlinedModel(response, value, obj, key, extractIterator)
|
1733
1769
|
);
|
1734
1770
|
case "I":
|
1735
1771
|
return Infinity;
|
@@ -1745,27 +1781,7 @@ function parseModelString(response, obj, key, value) {
|
|
1745
1781
|
return BigInt(value.slice(2));
|
1746
1782
|
}
|
1747
1783
|
value = parseInt(value.slice(1), 16);
|
1748
|
-
|
1749
|
-
switch (response.status) {
|
1750
|
-
case "resolved_model":
|
1751
|
-
initializeModelChunk(response);
|
1752
|
-
}
|
1753
|
-
switch (response.status) {
|
1754
|
-
case "fulfilled":
|
1755
|
-
return response.value;
|
1756
|
-
case "pending":
|
1757
|
-
case "blocked":
|
1758
|
-
return (
|
1759
|
-
(value = initializingChunk),
|
1760
|
-
response.then(
|
1761
|
-
createModelResolver(value, obj, key),
|
1762
|
-
createModelReject(value)
|
1763
|
-
),
|
1764
|
-
null
|
1765
|
-
);
|
1766
|
-
default:
|
1767
|
-
throw response.reason;
|
1768
|
-
}
|
1784
|
+
return getOutlinedModel(response, value, obj, key, createModel);
|
1769
1785
|
}
|
1770
1786
|
return value;
|
1771
1787
|
}
|
@@ -1926,9 +1926,8 @@ function renderFragment(request, task, children) {
|
|
1926
1926
|
|
1927
1927
|
function renderClientElement(task, type, key, props, owner) // DEV-only
|
1928
1928
|
{
|
1929
|
+
// We prepend the terminal client element that actually gets serialized with
|
1929
1930
|
// the keys of any Server Components which are not serialized.
|
1930
|
-
|
1931
|
-
|
1932
1931
|
var keyPath = task.keyPath;
|
1933
1932
|
|
1934
1933
|
if (key === null) {
|
@@ -2072,7 +2071,7 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
|
|
2072
2071
|
if (typeof model === 'object' && model !== null) {
|
2073
2072
|
// If we're about to write this into a new task we can assign it an ID early so that
|
2074
2073
|
// any other references can refer to the value we're about to write.
|
2075
|
-
if (
|
2074
|
+
if (keyPath !== null || implicitSlot) ; else {
|
2076
2075
|
request.writtenObjects.set(model, id);
|
2077
2076
|
}
|
2078
2077
|
}
|
@@ -2414,7 +2413,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2414
2413
|
var _existingId = _writtenObjects.get(value);
|
2415
2414
|
|
2416
2415
|
if (_existingId !== undefined) {
|
2417
|
-
if (
|
2416
|
+
if (task.keyPath !== null || task.implicitSlot) ; else if (modelRoot === value) {
|
2418
2417
|
// This is the ID we're currently emitting so we need to write it
|
2419
2418
|
// once but if we discover it again, we refer to it by id.
|
2420
2419
|
modelRoot = null;
|
@@ -2519,7 +2518,7 @@ function renderModelDestructive(request, task, parent, parentPropertyName, value
|
|
2519
2518
|
|
2520
2519
|
if (typeof value.then === 'function') {
|
2521
2520
|
if (existingId !== undefined) {
|
2522
|
-
if (
|
2521
|
+
if (task.keyPath !== null || task.implicitSlot) {
|
2523
2522
|
// If we're in some kind of context we can't reuse the result of this render or
|
2524
2523
|
// previous renders of this element. We only reuse Promises if they're not wrapped
|
2525
2524
|
// by another Server Component.
|
@@ -3675,7 +3674,7 @@ function loadServerReference$1(response, id, bound, parentChunk, parentObject, k
|
|
3675
3674
|
}
|
3676
3675
|
}
|
3677
3676
|
|
3678
|
-
promise.then(createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk)); // We need a placeholder value that will be replaced later.
|
3677
|
+
promise.then(createModelResolver(parentChunk, parentObject, key, false, response, createModel), createModelReject(parentChunk)); // We need a placeholder value that will be replaced later.
|
3679
3678
|
|
3680
3679
|
return null;
|
3681
3680
|
}
|
@@ -3752,21 +3751,24 @@ function getChunk(response, id) {
|
|
3752
3751
|
return chunk;
|
3753
3752
|
}
|
3754
3753
|
|
3755
|
-
function createModelResolver(chunk, parentObject, key) {
|
3754
|
+
function createModelResolver(chunk, parentObject, key, cyclic, response, map) {
|
3756
3755
|
var blocked;
|
3757
3756
|
|
3758
3757
|
if (initializingChunkBlockedModel) {
|
3759
3758
|
blocked = initializingChunkBlockedModel;
|
3760
|
-
|
3759
|
+
|
3760
|
+
if (!cyclic) {
|
3761
|
+
blocked.deps++;
|
3762
|
+
}
|
3761
3763
|
} else {
|
3762
3764
|
blocked = initializingChunkBlockedModel = {
|
3763
|
-
deps: 1,
|
3765
|
+
deps: cyclic ? 0 : 1,
|
3764
3766
|
value: null
|
3765
3767
|
};
|
3766
3768
|
}
|
3767
3769
|
|
3768
3770
|
return function (value) {
|
3769
|
-
parentObject[key] = value; // If this is the root object for a model reference, where `blocked.value`
|
3771
|
+
parentObject[key] = map(response, value); // If this is the root object for a model reference, where `blocked.value`
|
3770
3772
|
// is a stale `null`, the resolved value can be used directly.
|
3771
3773
|
|
3772
3774
|
if (key === '' && blocked.value === null) {
|
@@ -3798,19 +3800,46 @@ function createModelReject(chunk) {
|
|
3798
3800
|
};
|
3799
3801
|
}
|
3800
3802
|
|
3801
|
-
function getOutlinedModel(response, id) {
|
3803
|
+
function getOutlinedModel(response, id, parentObject, key, map) {
|
3802
3804
|
var chunk = getChunk(response, id);
|
3803
3805
|
|
3804
|
-
|
3805
|
-
|
3806
|
-
|
3806
|
+
switch (chunk.status) {
|
3807
|
+
case RESOLVED_MODEL:
|
3808
|
+
initializeModelChunk(chunk);
|
3809
|
+
break;
|
3810
|
+
} // The status might have changed after initialization.
|
3807
3811
|
|
3808
|
-
|
3809
|
-
|
3810
|
-
|
3812
|
+
|
3813
|
+
switch (chunk.status) {
|
3814
|
+
case INITIALIZED:
|
3815
|
+
return map(response, chunk.value);
|
3816
|
+
|
3817
|
+
case PENDING:
|
3818
|
+
case BLOCKED:
|
3819
|
+
var parentChunk = initializingChunk;
|
3820
|
+
chunk.then(createModelResolver(parentChunk, parentObject, key, false, response, map), createModelReject(parentChunk));
|
3821
|
+
return null;
|
3822
|
+
|
3823
|
+
default:
|
3824
|
+
throw chunk.reason;
|
3811
3825
|
}
|
3826
|
+
}
|
3827
|
+
|
3828
|
+
function createMap(response, model) {
|
3829
|
+
return new Map(model);
|
3830
|
+
}
|
3831
|
+
|
3832
|
+
function createSet(response, model) {
|
3833
|
+
return new Set(model);
|
3834
|
+
}
|
3812
3835
|
|
3813
|
-
|
3836
|
+
function extractIterator(response, model) {
|
3837
|
+
// $FlowFixMe[incompatible-use]: This uses raw Symbols because we're extracting from a native array.
|
3838
|
+
return model[Symbol.iterator]();
|
3839
|
+
}
|
3840
|
+
|
3841
|
+
function createModel(response, model) {
|
3842
|
+
return model;
|
3814
3843
|
}
|
3815
3844
|
|
3816
3845
|
function parseModelString(response, obj, key, value) {
|
@@ -3827,9 +3856,8 @@ function parseModelString(response, obj, key, value) {
|
|
3827
3856
|
// Promise
|
3828
3857
|
var _id = parseInt(value.slice(2), 16);
|
3829
3858
|
|
3830
|
-
var
|
3831
|
-
|
3832
|
-
return _chunk2;
|
3859
|
+
var chunk = getChunk(response, _id);
|
3860
|
+
return chunk;
|
3833
3861
|
}
|
3834
3862
|
|
3835
3863
|
case 'F':
|
@@ -3838,7 +3866,7 @@ function parseModelString(response, obj, key, value) {
|
|
3838
3866
|
var _id2 = parseInt(value.slice(2), 16); // TODO: Just encode this in the reference inline instead of as a model.
|
3839
3867
|
|
3840
3868
|
|
3841
|
-
var metaData = getOutlinedModel(response, _id2);
|
3869
|
+
var metaData = getOutlinedModel(response, _id2, obj, key, createModel);
|
3842
3870
|
return loadServerReference$1(response, metaData.id, metaData.bound, initializingChunk, obj, key);
|
3843
3871
|
}
|
3844
3872
|
|
@@ -3853,8 +3881,7 @@ function parseModelString(response, obj, key, value) {
|
|
3853
3881
|
// Map
|
3854
3882
|
var _id3 = parseInt(value.slice(2), 16);
|
3855
3883
|
|
3856
|
-
|
3857
|
-
return new Map(data);
|
3884
|
+
return getOutlinedModel(response, _id3, obj, key, createMap);
|
3858
3885
|
}
|
3859
3886
|
|
3860
3887
|
case 'W':
|
@@ -3862,9 +3889,7 @@ function parseModelString(response, obj, key, value) {
|
|
3862
3889
|
// Set
|
3863
3890
|
var _id4 = parseInt(value.slice(2), 16);
|
3864
3891
|
|
3865
|
-
|
3866
|
-
|
3867
|
-
return new Set(_data);
|
3892
|
+
return getOutlinedModel(response, _id4, obj, key, createSet);
|
3868
3893
|
}
|
3869
3894
|
|
3870
3895
|
case 'K':
|
@@ -3872,9 +3897,7 @@ function parseModelString(response, obj, key, value) {
|
|
3872
3897
|
// FormData
|
3873
3898
|
var stringId = value.slice(2);
|
3874
3899
|
var formPrefix = response._prefix + stringId + '_';
|
3875
|
-
|
3876
|
-
var _data2 = new FormData();
|
3877
|
-
|
3900
|
+
var data = new FormData();
|
3878
3901
|
var backingFormData = response._formData; // We assume that the reference to FormData always comes after each
|
3879
3902
|
// entry that it references so we can assume they all exist in the
|
3880
3903
|
// backing store already.
|
@@ -3882,10 +3905,10 @@ function parseModelString(response, obj, key, value) {
|
|
3882
3905
|
|
3883
3906
|
backingFormData.forEach(function (entry, entryKey) {
|
3884
3907
|
if (entryKey.startsWith(formPrefix)) {
|
3885
|
-
|
3908
|
+
data.append(entryKey.slice(formPrefix.length), entry);
|
3886
3909
|
}
|
3887
3910
|
});
|
3888
|
-
return
|
3911
|
+
return data;
|
3889
3912
|
}
|
3890
3913
|
|
3891
3914
|
case 'i':
|
@@ -3893,9 +3916,7 @@ function parseModelString(response, obj, key, value) {
|
|
3893
3916
|
// Iterator
|
3894
3917
|
var _id5 = parseInt(value.slice(2), 16);
|
3895
3918
|
|
3896
|
-
|
3897
|
-
|
3898
|
-
return _data3[Symbol.iterator]();
|
3919
|
+
return getOutlinedModel(response, _id5, obj, key, extractIterator);
|
3899
3920
|
}
|
3900
3921
|
|
3901
3922
|
case 'I':
|
@@ -3942,28 +3963,7 @@ function parseModelString(response, obj, key, value) {
|
|
3942
3963
|
|
3943
3964
|
|
3944
3965
|
var id = parseInt(value.slice(1), 16);
|
3945
|
-
|
3946
|
-
|
3947
|
-
switch (chunk.status) {
|
3948
|
-
case RESOLVED_MODEL:
|
3949
|
-
initializeModelChunk(chunk);
|
3950
|
-
break;
|
3951
|
-
} // The status might have changed after initialization.
|
3952
|
-
|
3953
|
-
|
3954
|
-
switch (chunk.status) {
|
3955
|
-
case INITIALIZED:
|
3956
|
-
return chunk.value;
|
3957
|
-
|
3958
|
-
case PENDING:
|
3959
|
-
case BLOCKED:
|
3960
|
-
var parentChunk = initializingChunk;
|
3961
|
-
chunk.then(createModelResolver(parentChunk, obj, key), createModelReject(parentChunk));
|
3962
|
-
return null;
|
3963
|
-
|
3964
|
-
default:
|
3965
|
-
throw chunk.reason;
|
3966
|
-
}
|
3966
|
+
return getOutlinedModel(response, id, obj, key, createModel);
|
3967
3967
|
}
|
3968
3968
|
|
3969
3969
|
return value;
|