@farm.js/react 0.1.0-beta.11 → 0.1.0-beta.12
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/dist/compiler-runtime.cjs +196 -79
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.mjs +196 -79
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/index.mjs.map +1 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1763,7 +1763,6 @@ function createConditionalBlockComponent(owner) {
|
|
|
1763
1763
|
}
|
|
1764
1764
|
componentWillUnmount() {
|
|
1765
1765
|
this.unsubscribe?.();
|
|
1766
|
-
owner.setRoot(this.props.id, null);
|
|
1767
1766
|
}
|
|
1768
1767
|
render() {
|
|
1769
1768
|
const node = this.props.render();
|
|
@@ -1884,33 +1883,65 @@ function materializeCompilerHostChildren(descriptor) {
|
|
|
1884
1883
|
children.push(...staticChildren.slice(cursor, cursor + block.trailing));
|
|
1885
1884
|
return children;
|
|
1886
1885
|
}
|
|
1887
|
-
function
|
|
1888
|
-
for (const child of flattenCompilerHostElements(descriptor
|
|
1889
|
-
|
|
1886
|
+
function collectActiveCompilerHostBlockIds(descriptor, ids) {
|
|
1887
|
+
for (const child of flattenCompilerHostElements(materializeCompilerHostChildren(descriptor))) {
|
|
1888
|
+
collectActiveCompilerHostBlockIds(child, ids);
|
|
1890
1889
|
}
|
|
1891
1890
|
const block = descriptor.block;
|
|
1892
|
-
if (!block
|
|
1891
|
+
if (!block) return;
|
|
1893
1892
|
ids.add(block.id);
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1893
|
+
}
|
|
1894
|
+
function reconcileCompilerFallbackSubscriptions(owner, subscriptions, ids, refresh) {
|
|
1895
|
+
for (const [id, unsubscribe] of subscriptions) {
|
|
1896
|
+
if (ids.has(id)) continue;
|
|
1897
|
+
unsubscribe();
|
|
1898
|
+
subscriptions.delete(id);
|
|
1899
|
+
}
|
|
1900
|
+
for (const id of ids) {
|
|
1901
|
+
if (!subscriptions.has(id)) subscriptions.set(id, owner.subscribe(id, refresh));
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
function clearCompilerFallbackSubscriptions(subscriptions) {
|
|
1905
|
+
for (const unsubscribe of subscriptions.values()) unsubscribe();
|
|
1906
|
+
subscriptions.clear();
|
|
1907
|
+
}
|
|
1908
|
+
function hasUnsafeCompilerFallbackKeys(descriptor) {
|
|
1909
|
+
const visitKeyedRange = (range) => {
|
|
1910
|
+
const items = materializeIterable(range.items());
|
|
1911
|
+
const keys = items.map((item, index) => keyedRowIdentity(range.rowKey(item, index)));
|
|
1912
|
+
if (new Set(keys).size !== keys.length) return true;
|
|
1913
|
+
return items.some((item, index) => visit(range.create(item, index)));
|
|
1914
|
+
};
|
|
1915
|
+
const visit = (current) => {
|
|
1916
|
+
for (const child of flattenCompilerHostElements(current.children)) {
|
|
1917
|
+
if (visit(child)) return true;
|
|
1918
|
+
}
|
|
1919
|
+
const block = current.block;
|
|
1920
|
+
if (!block) return false;
|
|
1921
|
+
if (block.kind === "conditional-ranges") {
|
|
1922
|
+
for (const range of block.ranges) {
|
|
1923
|
+
const selection = hostConditionalSelection(range);
|
|
1924
|
+
if (selection.kind === "branch" && visit(selection.branch.create())) return true;
|
|
1925
|
+
}
|
|
1926
|
+
return false;
|
|
1898
1927
|
}
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
const first = materializeIterable(range.items())[0];
|
|
1902
|
-
if (first !== void 0) collectCompilerHostBlockIds(range.create(first, 0), ids);
|
|
1928
|
+
if (block.kind === "keyed-ranges") {
|
|
1929
|
+
return block.ranges.some(visitKeyedRange);
|
|
1903
1930
|
}
|
|
1904
|
-
} else {
|
|
1905
1931
|
for (const range of block.ranges) {
|
|
1906
|
-
if (range.kind === "
|
|
1907
|
-
if (
|
|
1908
|
-
|
|
1909
|
-
} else {
|
|
1910
|
-
const first = materializeIterable(range.items())[0];
|
|
1911
|
-
if (first !== void 0) collectCompilerHostBlockIds(range.create(first, 0), ids);
|
|
1932
|
+
if (range.kind === "keyed") {
|
|
1933
|
+
if (visitKeyedRange(range)) return true;
|
|
1934
|
+
continue;
|
|
1912
1935
|
}
|
|
1936
|
+
const selection = hostConditionalSelection(range);
|
|
1937
|
+
if (selection.kind === "branch" && visit(selection.branch.create())) return true;
|
|
1913
1938
|
}
|
|
1939
|
+
return false;
|
|
1940
|
+
};
|
|
1941
|
+
try {
|
|
1942
|
+
return visit(descriptor);
|
|
1943
|
+
} catch {
|
|
1944
|
+
return true;
|
|
1914
1945
|
}
|
|
1915
1946
|
}
|
|
1916
1947
|
function findCompilerHostTarget(root, path) {
|
|
@@ -3216,13 +3247,18 @@ function createHostConditionalBlockComponent(owner) {
|
|
|
3216
3247
|
this.fallbackVersion = 0;
|
|
3217
3248
|
this.propSyncQueued = false;
|
|
3218
3249
|
this.currentProps = this.props;
|
|
3219
|
-
this.fallbackUnsubscribers =
|
|
3250
|
+
this.fallbackUnsubscribers = /* @__PURE__ */ new Map();
|
|
3251
|
+
this.fallbackKeysWereUnsafe = false;
|
|
3220
3252
|
this.activeBranch = null;
|
|
3221
3253
|
this.instance = null;
|
|
3222
3254
|
this.requestNestedFallback = () => {
|
|
3223
3255
|
this.instance?.scope?.cleanup();
|
|
3224
3256
|
this.activateFallback();
|
|
3225
3257
|
};
|
|
3258
|
+
this.refreshFallbackDescendant = (afterCommit) => {
|
|
3259
|
+
this.prepareFallbackUpdate();
|
|
3260
|
+
this.forceUpdate(afterCommit);
|
|
3261
|
+
};
|
|
3226
3262
|
this.captureRoot = (root) => {
|
|
3227
3263
|
this.root = root;
|
|
3228
3264
|
};
|
|
@@ -3231,25 +3267,32 @@ function createHostConditionalBlockComponent(owner) {
|
|
|
3231
3267
|
};
|
|
3232
3268
|
}
|
|
3233
3269
|
subscribeFallbackDescendants() {
|
|
3234
|
-
for (const unsubscribe of this.fallbackUnsubscribers) unsubscribe();
|
|
3235
|
-
this.fallbackUnsubscribers = [];
|
|
3236
3270
|
const ids = /* @__PURE__ */ new Set();
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
if (this.currentProps.falsy) {
|
|
3241
|
-
collectCompilerHostBlockIds(this.currentProps.falsy.create(), ids);
|
|
3271
|
+
const selection = hostConditionalSelection(this.currentProps);
|
|
3272
|
+
if (selection.kind === "branch") {
|
|
3273
|
+
collectActiveCompilerHostBlockIds(selection.branch.create(), ids);
|
|
3242
3274
|
}
|
|
3243
3275
|
ids.delete(this.currentProps.id);
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3276
|
+
reconcileCompilerFallbackSubscriptions(
|
|
3277
|
+
owner,
|
|
3278
|
+
this.fallbackUnsubscribers,
|
|
3279
|
+
ids,
|
|
3280
|
+
this.refreshFallbackDescendant
|
|
3281
|
+
);
|
|
3282
|
+
}
|
|
3283
|
+
hasUnsafeFallbackKeys() {
|
|
3284
|
+
try {
|
|
3285
|
+
const selection = hostConditionalSelection(this.currentProps);
|
|
3286
|
+
return selection.kind === "branch" && hasUnsafeCompilerFallbackKeys(selection.branch.create());
|
|
3287
|
+
} catch {
|
|
3288
|
+
return true;
|
|
3251
3289
|
}
|
|
3252
3290
|
}
|
|
3291
|
+
prepareFallbackUpdate() {
|
|
3292
|
+
const unsafeKeys = this.hasUnsafeFallbackKeys();
|
|
3293
|
+
if (unsafeKeys || this.fallbackKeysWereUnsafe) this.fallbackVersion += 1;
|
|
3294
|
+
this.fallbackKeysWereUnsafe = unsafeKeys;
|
|
3295
|
+
}
|
|
3253
3296
|
adopt() {
|
|
3254
3297
|
if (!this.root) return false;
|
|
3255
3298
|
const selection = hostConditionalSelection(this.currentProps);
|
|
@@ -3288,6 +3331,7 @@ function createHostConditionalBlockComponent(owner) {
|
|
|
3288
3331
|
this.instance = null;
|
|
3289
3332
|
this.activeBranch = null;
|
|
3290
3333
|
this.subscribeFallbackDescendants();
|
|
3334
|
+
this.fallbackKeysWereUnsafe = this.hasUnsafeFallbackKeys();
|
|
3291
3335
|
this.fallbackVersion += 1;
|
|
3292
3336
|
this.setState({ fallback: true }, afterCommit);
|
|
3293
3337
|
}
|
|
@@ -3297,6 +3341,7 @@ function createHostConditionalBlockComponent(owner) {
|
|
|
3297
3341
|
return;
|
|
3298
3342
|
}
|
|
3299
3343
|
if (this.state.fallback) {
|
|
3344
|
+
this.prepareFallbackUpdate();
|
|
3300
3345
|
this.forceUpdate(afterCommit);
|
|
3301
3346
|
return;
|
|
3302
3347
|
}
|
|
@@ -3360,6 +3405,7 @@ function createHostConditionalBlockComponent(owner) {
|
|
|
3360
3405
|
}
|
|
3361
3406
|
shouldComponentUpdate(nextProps, nextState) {
|
|
3362
3407
|
this.currentProps = nextProps;
|
|
3408
|
+
if (this.state.fallback && nextState.fallback) this.prepareFallbackUpdate();
|
|
3363
3409
|
if (nextState.fallback || this.state.fallback) return true;
|
|
3364
3410
|
this.schedulePropSync();
|
|
3365
3411
|
return false;
|
|
@@ -3367,13 +3413,19 @@ function createHostConditionalBlockComponent(owner) {
|
|
|
3367
3413
|
componentDidMount() {
|
|
3368
3414
|
this.mounted = true;
|
|
3369
3415
|
this.unsubscribe = owner.subscribe(this.props.id, this.refresh);
|
|
3370
|
-
if (
|
|
3416
|
+
if (this.state.fallback || this.fallbackRequested) {
|
|
3417
|
+
this.subscribeFallbackDescendants();
|
|
3418
|
+
this.fallbackKeysWereUnsafe = this.hasUnsafeFallbackKeys();
|
|
3419
|
+
} else if (!this.adopt()) this.activateFallback();
|
|
3420
|
+
}
|
|
3421
|
+
componentDidUpdate() {
|
|
3422
|
+
if (this.state.fallback) this.subscribeFallbackDescendants();
|
|
3371
3423
|
}
|
|
3372
3424
|
componentWillUnmount() {
|
|
3373
3425
|
this.mounted = false;
|
|
3374
3426
|
this.unsubscribe?.();
|
|
3375
|
-
|
|
3376
|
-
this.
|
|
3427
|
+
clearCompilerFallbackSubscriptions(this.fallbackUnsubscribers);
|
|
3428
|
+
this.fallbackKeysWereUnsafe = false;
|
|
3377
3429
|
this.instance?.scope?.cleanup();
|
|
3378
3430
|
this.activeBranch = null;
|
|
3379
3431
|
this.instance = null;
|
|
@@ -3405,7 +3457,8 @@ function createConditionalRangesBlockComponent(owner) {
|
|
|
3405
3457
|
this.fallbackVersion = 0;
|
|
3406
3458
|
this.propFallbackQueued = false;
|
|
3407
3459
|
this.currentProps = this.props;
|
|
3408
|
-
this.fallbackUnsubscribers =
|
|
3460
|
+
this.fallbackUnsubscribers = /* @__PURE__ */ new Map();
|
|
3461
|
+
this.fallbackKeysWereUnsafe = false;
|
|
3409
3462
|
this.rangeInstances = [];
|
|
3410
3463
|
this.staticSegments = [];
|
|
3411
3464
|
this.staticValues = [];
|
|
@@ -3413,6 +3466,10 @@ function createConditionalRangesBlockComponent(owner) {
|
|
|
3413
3466
|
for (const instance of this.rangeInstances) instance?.host.scope?.cleanup();
|
|
3414
3467
|
this.activateFallback();
|
|
3415
3468
|
};
|
|
3469
|
+
this.refreshFallbackDescendant = (afterCommit) => {
|
|
3470
|
+
this.prepareFallbackUpdate();
|
|
3471
|
+
this.forceUpdate(afterCommit);
|
|
3472
|
+
};
|
|
3416
3473
|
this.captureRoot = (root) => {
|
|
3417
3474
|
this.root = root;
|
|
3418
3475
|
this.currentProps.rootRef?.(root);
|
|
@@ -3422,23 +3479,39 @@ function createConditionalRangesBlockComponent(owner) {
|
|
|
3422
3479
|
};
|
|
3423
3480
|
}
|
|
3424
3481
|
subscribeFallbackDescendants() {
|
|
3425
|
-
for (const unsubscribe of this.fallbackUnsubscribers) unsubscribe();
|
|
3426
|
-
this.fallbackUnsubscribers = [];
|
|
3427
3482
|
const ids = /* @__PURE__ */ new Set();
|
|
3428
3483
|
for (const range of this.currentProps.ranges) {
|
|
3429
|
-
|
|
3430
|
-
if (
|
|
3484
|
+
const selection = hostConditionalSelection(range);
|
|
3485
|
+
if (selection.kind === "branch") {
|
|
3486
|
+
collectActiveCompilerHostBlockIds(selection.branch.create(), ids);
|
|
3487
|
+
}
|
|
3431
3488
|
}
|
|
3432
3489
|
ids.delete(this.currentProps.id);
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3490
|
+
reconcileCompilerFallbackSubscriptions(
|
|
3491
|
+
owner,
|
|
3492
|
+
this.fallbackUnsubscribers,
|
|
3493
|
+
ids,
|
|
3494
|
+
this.refreshFallbackDescendant
|
|
3495
|
+
);
|
|
3496
|
+
}
|
|
3497
|
+
hasUnsafeFallbackKeys() {
|
|
3498
|
+
try {
|
|
3499
|
+
for (const range of this.currentProps.ranges) {
|
|
3500
|
+
const selection = hostConditionalSelection(range);
|
|
3501
|
+
if (selection.kind === "branch" && hasUnsafeCompilerFallbackKeys(selection.branch.create())) {
|
|
3502
|
+
return true;
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
return false;
|
|
3506
|
+
} catch {
|
|
3507
|
+
return true;
|
|
3440
3508
|
}
|
|
3441
3509
|
}
|
|
3510
|
+
prepareFallbackUpdate() {
|
|
3511
|
+
const unsafeKeys = this.hasUnsafeFallbackKeys();
|
|
3512
|
+
if (unsafeKeys || this.fallbackKeysWereUnsafe) this.fallbackVersion += 1;
|
|
3513
|
+
this.fallbackKeysWereUnsafe = unsafeKeys;
|
|
3514
|
+
}
|
|
3442
3515
|
readSelections(props) {
|
|
3443
3516
|
const selections = [];
|
|
3444
3517
|
for (const range of props.ranges) {
|
|
@@ -3582,7 +3655,7 @@ function createConditionalRangesBlockComponent(owner) {
|
|
|
3582
3655
|
return;
|
|
3583
3656
|
}
|
|
3584
3657
|
if (this.state.fallback) {
|
|
3585
|
-
this.
|
|
3658
|
+
this.prepareFallbackUpdate();
|
|
3586
3659
|
this.forceUpdate(afterCommit);
|
|
3587
3660
|
return;
|
|
3588
3661
|
}
|
|
@@ -3619,6 +3692,7 @@ function createConditionalRangesBlockComponent(owner) {
|
|
|
3619
3692
|
this.fallbackRequested = true;
|
|
3620
3693
|
for (const instance of this.rangeInstances) instance?.host.scope?.cleanup();
|
|
3621
3694
|
this.subscribeFallbackDescendants();
|
|
3695
|
+
this.fallbackKeysWereUnsafe = this.hasUnsafeFallbackKeys();
|
|
3622
3696
|
this.setState({ fallback: true }, afterCommit);
|
|
3623
3697
|
}
|
|
3624
3698
|
schedulePropFallback() {
|
|
@@ -3631,6 +3705,7 @@ function createConditionalRangesBlockComponent(owner) {
|
|
|
3631
3705
|
}
|
|
3632
3706
|
shouldComponentUpdate(nextProps, nextState) {
|
|
3633
3707
|
this.currentProps = nextProps;
|
|
3708
|
+
if (this.state.fallback && nextState.fallback) this.prepareFallbackUpdate();
|
|
3634
3709
|
if (nextState.fallback || this.state.fallback) return true;
|
|
3635
3710
|
this.schedulePropFallback();
|
|
3636
3711
|
return false;
|
|
@@ -3638,13 +3713,19 @@ function createConditionalRangesBlockComponent(owner) {
|
|
|
3638
3713
|
componentDidMount() {
|
|
3639
3714
|
this.mounted = true;
|
|
3640
3715
|
this.unsubscribe = owner.subscribe(this.props.id, this.refresh);
|
|
3641
|
-
if (
|
|
3716
|
+
if (this.state.fallback || this.fallbackRequested) {
|
|
3717
|
+
this.subscribeFallbackDescendants();
|
|
3718
|
+
this.fallbackKeysWereUnsafe = this.hasUnsafeFallbackKeys();
|
|
3719
|
+
} else if (!this.adopt()) this.activateFallback();
|
|
3720
|
+
}
|
|
3721
|
+
componentDidUpdate() {
|
|
3722
|
+
if (this.state.fallback) this.subscribeFallbackDescendants();
|
|
3642
3723
|
}
|
|
3643
3724
|
componentWillUnmount() {
|
|
3644
3725
|
this.mounted = false;
|
|
3645
3726
|
this.unsubscribe?.();
|
|
3646
|
-
|
|
3647
|
-
this.
|
|
3727
|
+
clearCompilerFallbackSubscriptions(this.fallbackUnsubscribers);
|
|
3728
|
+
this.fallbackKeysWereUnsafe = false;
|
|
3648
3729
|
for (const instance of this.rangeInstances) instance?.host.scope?.cleanup();
|
|
3649
3730
|
this.rangeInstances = [];
|
|
3650
3731
|
this.staticSegments = [];
|
|
@@ -6139,9 +6220,7 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
6139
6220
|
}
|
|
6140
6221
|
if (this.state.fallback) {
|
|
6141
6222
|
const unsafeKeys = this.hasUnsafeFallbackKeys();
|
|
6142
|
-
if (unsafeKeys || this.fallbackKeysWereUnsafe)
|
|
6143
|
-
this.fallbackVersion += 1;
|
|
6144
|
-
}
|
|
6223
|
+
if (unsafeKeys || this.fallbackKeysWereUnsafe) this.fallbackVersion += 1;
|
|
6145
6224
|
this.fallbackKeysWereUnsafe = unsafeKeys;
|
|
6146
6225
|
this.forceUpdate(afterCommit);
|
|
6147
6226
|
return;
|
|
@@ -6277,6 +6356,11 @@ function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
|
6277
6356
|
const wasReactOwned = this.hasReactOwnedRows(this.currentProps);
|
|
6278
6357
|
const willBeReactOwned = this.hasReactOwnedRows(nextProps);
|
|
6279
6358
|
this.currentProps = nextProps;
|
|
6359
|
+
if (this.state.fallback && nextState.fallback) {
|
|
6360
|
+
const unsafeKeys = this.hasUnsafeFallbackKeys();
|
|
6361
|
+
if (unsafeKeys || this.fallbackKeysWereUnsafe) this.fallbackVersion += 1;
|
|
6362
|
+
this.fallbackKeysWereUnsafe = unsafeKeys;
|
|
6363
|
+
}
|
|
6280
6364
|
if (nextState.fallback || this.state.fallback) return true;
|
|
6281
6365
|
if (wasReactOwned || willBeReactOwned) {
|
|
6282
6366
|
this.eventHandlers.clear();
|
|
@@ -6335,6 +6419,7 @@ function createKeyedRangesBlockComponent(owner) {
|
|
|
6335
6419
|
this.mounted = false;
|
|
6336
6420
|
this.fallbackRequested = false;
|
|
6337
6421
|
this.fallbackVersion = 0;
|
|
6422
|
+
this.fallbackKeysWereUnsafe = false;
|
|
6338
6423
|
this.propFallbackQueued = false;
|
|
6339
6424
|
this.currentProps = this.props;
|
|
6340
6425
|
this.rangeInstances = [];
|
|
@@ -6363,6 +6448,13 @@ function createKeyedRangesBlockComponent(owner) {
|
|
|
6363
6448
|
}
|
|
6364
6449
|
return ranges;
|
|
6365
6450
|
}
|
|
6451
|
+
hasUnsafeFallbackKeys() {
|
|
6452
|
+
try {
|
|
6453
|
+
return this.readRanges(this.currentProps) === null;
|
|
6454
|
+
} catch {
|
|
6455
|
+
return true;
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6366
6458
|
adopt(props = this.currentProps) {
|
|
6367
6459
|
if (!this.root || !Number.isSafeInteger(props.trailing) || props.trailing < 0) return false;
|
|
6368
6460
|
const rowsByRange = this.readRanges(props);
|
|
@@ -6475,7 +6567,9 @@ function createKeyedRangesBlockComponent(owner) {
|
|
|
6475
6567
|
return;
|
|
6476
6568
|
}
|
|
6477
6569
|
if (this.state.fallback) {
|
|
6478
|
-
this.
|
|
6570
|
+
const unsafeKeys = this.hasUnsafeFallbackKeys();
|
|
6571
|
+
if (unsafeKeys || this.fallbackKeysWereUnsafe) this.fallbackVersion += 1;
|
|
6572
|
+
this.fallbackKeysWereUnsafe = unsafeKeys;
|
|
6479
6573
|
this.forceUpdate(afterCommit);
|
|
6480
6574
|
return;
|
|
6481
6575
|
}
|
|
@@ -6508,6 +6602,7 @@ function createKeyedRangesBlockComponent(owner) {
|
|
|
6508
6602
|
return;
|
|
6509
6603
|
}
|
|
6510
6604
|
this.fallbackRequested = true;
|
|
6605
|
+
this.fallbackKeysWereUnsafe = this.hasUnsafeFallbackKeys();
|
|
6511
6606
|
this.setState({ fallback: true }, afterCommit);
|
|
6512
6607
|
}
|
|
6513
6608
|
schedulePropFallback() {
|
|
@@ -6520,6 +6615,11 @@ function createKeyedRangesBlockComponent(owner) {
|
|
|
6520
6615
|
}
|
|
6521
6616
|
shouldComponentUpdate(nextProps, nextState) {
|
|
6522
6617
|
this.currentProps = nextProps;
|
|
6618
|
+
if (this.state.fallback && nextState.fallback) {
|
|
6619
|
+
const unsafeKeys = this.hasUnsafeFallbackKeys();
|
|
6620
|
+
if (unsafeKeys || this.fallbackKeysWereUnsafe) this.fallbackVersion += 1;
|
|
6621
|
+
this.fallbackKeysWereUnsafe = unsafeKeys;
|
|
6622
|
+
}
|
|
6523
6623
|
if (nextState.fallback || this.state.fallback) return true;
|
|
6524
6624
|
this.schedulePropFallback();
|
|
6525
6625
|
return false;
|
|
@@ -6561,14 +6661,24 @@ function createMixedRangesBlockComponent(owner) {
|
|
|
6561
6661
|
this.mounted = false;
|
|
6562
6662
|
this.fallbackRequested = false;
|
|
6563
6663
|
this.fallbackVersion = 0;
|
|
6664
|
+
this.fallbackKeysWereUnsafe = false;
|
|
6564
6665
|
this.propFallbackQueued = false;
|
|
6565
6666
|
this.currentProps = this.props;
|
|
6566
6667
|
this.controller = null;
|
|
6567
|
-
this.fallbackUnsubscribers =
|
|
6668
|
+
this.fallbackUnsubscribers = /* @__PURE__ */ new Map();
|
|
6568
6669
|
this.captureRoot = (root) => {
|
|
6569
6670
|
this.root = root;
|
|
6570
6671
|
this.currentProps.rootRef?.(root);
|
|
6571
6672
|
};
|
|
6673
|
+
this.refreshFallbackBlock = (afterCommit) => {
|
|
6674
|
+
if (!this.mounted || !this.state.fallback) {
|
|
6675
|
+
afterCommit?.();
|
|
6676
|
+
return;
|
|
6677
|
+
}
|
|
6678
|
+
const nextDescriptor = this.currentProps.create();
|
|
6679
|
+
this.prepareFallbackUpdate(nextDescriptor);
|
|
6680
|
+
this.forceUpdate(afterCommit);
|
|
6681
|
+
};
|
|
6572
6682
|
this.activateFallback = (afterCommit) => {
|
|
6573
6683
|
if (!this.mounted || this.state.fallback || this.fallbackRequested) {
|
|
6574
6684
|
afterCommit?.();
|
|
@@ -6577,6 +6687,7 @@ function createMixedRangesBlockComponent(owner) {
|
|
|
6577
6687
|
this.fallbackRequested = true;
|
|
6578
6688
|
this.controller?.cleanup();
|
|
6579
6689
|
this.controller = null;
|
|
6690
|
+
this.fallbackKeysWereUnsafe = hasUnsafeCompilerFallbackKeys(this.currentProps.create());
|
|
6580
6691
|
this.fallbackVersion += 1;
|
|
6581
6692
|
this.setState({ fallback: true }, () => {
|
|
6582
6693
|
this.subscribeFallbackBlocks();
|
|
@@ -6585,26 +6696,27 @@ function createMixedRangesBlockComponent(owner) {
|
|
|
6585
6696
|
};
|
|
6586
6697
|
}
|
|
6587
6698
|
clearFallbackSubscriptions() {
|
|
6588
|
-
|
|
6589
|
-
|
|
6699
|
+
clearCompilerFallbackSubscriptions(this.fallbackUnsubscribers);
|
|
6700
|
+
}
|
|
6701
|
+
readFallbackBlockIds(descriptor) {
|
|
6702
|
+
const ids = /* @__PURE__ */ new Set();
|
|
6703
|
+
collectActiveCompilerHostBlockIds(descriptor, ids);
|
|
6704
|
+
return ids;
|
|
6705
|
+
}
|
|
6706
|
+
prepareFallbackUpdate(descriptor) {
|
|
6707
|
+
const unsafeKeys = hasUnsafeCompilerFallbackKeys(descriptor);
|
|
6708
|
+
if (unsafeKeys || this.fallbackKeysWereUnsafe) this.fallbackVersion += 1;
|
|
6709
|
+
this.fallbackKeysWereUnsafe = unsafeKeys;
|
|
6590
6710
|
}
|
|
6591
6711
|
subscribeFallbackBlocks() {
|
|
6592
|
-
this.clearFallbackSubscriptions();
|
|
6593
6712
|
const descriptor = this.currentProps.create();
|
|
6594
|
-
const ids =
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
this.fallbackUnsubscribers
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
return;
|
|
6602
|
-
}
|
|
6603
|
-
this.fallbackVersion += 1;
|
|
6604
|
-
this.forceUpdate(afterCommit);
|
|
6605
|
-
})
|
|
6606
|
-
);
|
|
6607
|
-
}
|
|
6713
|
+
const ids = this.readFallbackBlockIds(descriptor);
|
|
6714
|
+
reconcileCompilerFallbackSubscriptions(
|
|
6715
|
+
owner,
|
|
6716
|
+
this.fallbackUnsubscribers,
|
|
6717
|
+
ids,
|
|
6718
|
+
this.refreshFallbackBlock
|
|
6719
|
+
);
|
|
6608
6720
|
}
|
|
6609
6721
|
adopt() {
|
|
6610
6722
|
if (!this.root) return false;
|
|
@@ -6640,13 +6752,19 @@ function createMixedRangesBlockComponent(owner) {
|
|
|
6640
6752
|
}
|
|
6641
6753
|
shouldComponentUpdate(nextProps, nextState) {
|
|
6642
6754
|
this.currentProps = nextProps;
|
|
6755
|
+
if (this.state.fallback && nextState.fallback) {
|
|
6756
|
+
this.prepareFallbackUpdate(this.currentProps.create());
|
|
6757
|
+
}
|
|
6643
6758
|
if (nextState.fallback || this.state.fallback) return true;
|
|
6644
6759
|
this.schedulePropFallback();
|
|
6645
6760
|
return false;
|
|
6646
6761
|
}
|
|
6647
6762
|
componentDidMount() {
|
|
6648
6763
|
this.mounted = true;
|
|
6649
|
-
if (
|
|
6764
|
+
if (this.state.fallback || this.fallbackRequested) {
|
|
6765
|
+
this.fallbackKeysWereUnsafe = hasUnsafeCompilerFallbackKeys(this.currentProps.create());
|
|
6766
|
+
this.subscribeFallbackBlocks();
|
|
6767
|
+
} else if (!this.adopt()) this.activateFallback();
|
|
6650
6768
|
}
|
|
6651
6769
|
componentDidUpdate() {
|
|
6652
6770
|
if (this.state.fallback) this.subscribeFallbackBlocks();
|
|
@@ -6656,6 +6774,7 @@ function createMixedRangesBlockComponent(owner) {
|
|
|
6656
6774
|
this.controller?.cleanup();
|
|
6657
6775
|
this.controller = null;
|
|
6658
6776
|
this.clearFallbackSubscriptions();
|
|
6777
|
+
this.fallbackKeysWereUnsafe = false;
|
|
6659
6778
|
}
|
|
6660
6779
|
render() {
|
|
6661
6780
|
const container = this.currentProps.render();
|
|
@@ -7772,8 +7891,6 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
7772
7891
|
this.dirtyState.clear();
|
|
7773
7892
|
this.inputSelection = null;
|
|
7774
7893
|
this.blockRefreshListeners.clear();
|
|
7775
|
-
this.blockRoots.clear();
|
|
7776
|
-
this.blockRootElements.clear();
|
|
7777
7894
|
this.bindingTargetRefs.clear();
|
|
7778
7895
|
this.indexedDefinition = null;
|
|
7779
7896
|
this.staticBindingsByDependency = [];
|