@my-react/react-reconciler-compact 0.0.12 → 0.0.13

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.
@@ -348,8 +348,10 @@ function requireIndex_development () {
348
348
  return ListTreeNode;
349
349
  }());
350
350
  var ListTree = /** @class */ (function () {
351
- function ListTree() {
351
+ function ListTree(max) {
352
352
  this.length = 0;
353
+ this.maxLength = Infinity;
354
+ this.maxLength = max || Infinity;
353
355
  var _stickyHead = null;
354
356
  Object.defineProperty(this, "stickyHead", {
355
357
  get: function () {
@@ -388,6 +390,9 @@ function requireIndex_development () {
388
390
  });
389
391
  }
390
392
  ListTree.prototype.push = function (node) {
393
+ while (this.length >= this.maxLength) {
394
+ this.pop();
395
+ }
391
396
  var listNode = new ListTreeNode(node);
392
397
  this.length++;
393
398
  if (!this.foot) {
@@ -405,6 +410,7 @@ function requireIndex_development () {
405
410
  var node_1 = this.stickyFoot;
406
411
  this.push(node_1.value);
407
412
  this.stickyFoot = null;
413
+ this.length--;
408
414
  }
409
415
  else {
410
416
  this.length++;
@@ -417,6 +423,7 @@ function requireIndex_development () {
417
423
  var node_2 = this.stickyHead;
418
424
  this.unshift(node_2.value);
419
425
  this.stickyHead = null;
426
+ this.length--;
420
427
  }
421
428
  else {
422
429
  this.length++;
@@ -435,6 +442,9 @@ function requireIndex_development () {
435
442
  }
436
443
  };
437
444
  ListTree.prototype.unshift = function (node) {
445
+ while (this.length >= this.maxLength) {
446
+ this.shift();
447
+ }
438
448
  var listNode = new ListTreeNode(node);
439
449
  this.length++;
440
450
  if (!this.head) {
@@ -452,6 +462,7 @@ function requireIndex_development () {
452
462
  var node_3 = this.stickyHead;
453
463
  this.unshift(node_3.value);
454
464
  this.stickyHead = null;
465
+ this.length--;
455
466
  }
456
467
  else {
457
468
  this.length++;
@@ -464,6 +475,7 @@ function requireIndex_development () {
464
475
  var node_4 = this.stickyFoot;
465
476
  this.push(node_4.value);
466
477
  this.stickyFoot = null;
478
+ this.length--;
467
479
  }
468
480
  else {
469
481
  this.length++;
@@ -615,7 +627,7 @@ function requireIndex_development () {
615
627
  return newList;
616
628
  };
617
629
  ListTree.prototype.clone = function () {
618
- var newList = new ListTree();
630
+ var newList = new ListTree(this.maxLength);
619
631
  this.listToFoot(function (v) { return newList.push(v); });
620
632
  return newList;
621
633
  };
@@ -2344,12 +2356,52 @@ function requireIndex_development () {
2344
2356
  }
2345
2357
  // TODO update flow
2346
2358
  if (enableSuspenseRoot$2.current) {
2347
- var suspenseField = getInstanceFieldByInstance(renderDispatch);
2348
- var list = suspenseField.asyncLoadList.getAll();
2359
+ var suspenseField_1 = getInstanceFieldByInstance(renderDispatch);
2360
+ var list = suspenseField_1.asyncLoadList.getAll();
2349
2361
  if (list.length === 0)
2350
2362
  return;
2351
2363
  if (renderDispatch.enableAsyncLoad) {
2352
- throw new Error("[@my-react/reconciler] not implemented yet");
2364
+ var allPendingLoadArray = list.filter(function (item) {
2365
+ if (isPromise(item)) {
2366
+ return typeof item.status !== "string";
2367
+ }
2368
+ else {
2369
+ return !item._loading && !item._loaded && !item._error;
2370
+ }
2371
+ });
2372
+ if (allPendingLoadArray.length) {
2373
+ Promise.all(allPendingLoadArray.map(function (item) { return __awaiter(void 0, void 0, void 0, function () {
2374
+ var allNode;
2375
+ var _a;
2376
+ return __generator(this, function (_b) {
2377
+ switch (_b.label) {
2378
+ case 0:
2379
+ if (!isPromise(item)) return [3 /*break*/, 2];
2380
+ return [4 /*yield*/, renderDispatch.processPromise(item)];
2381
+ case 1:
2382
+ _b.sent();
2383
+ return [3 /*break*/, 4];
2384
+ case 2: return [4 /*yield*/, renderDispatch.processLazy(item)];
2385
+ case 3:
2386
+ _b.sent();
2387
+ _b.label = 4;
2388
+ case 4:
2389
+ allNode = Array.from(item._list);
2390
+ (_a = item._list) === null || _a === void 0 ? void 0 : _a.clear();
2391
+ allNode.forEach(function (node) {
2392
+ node.state = STATE_TYPE.__reschedule__;
2393
+ });
2394
+ suspenseField_1.asyncLoadList.uniDelete(item);
2395
+ return [2 /*return*/];
2396
+ }
2397
+ });
2398
+ }); }));
2399
+ var root = renderDispatch.rootFiber;
2400
+ root.state = remove(root.state, STATE_TYPE.__stable__);
2401
+ root.state = merge(root.state, STATE_TYPE.__retrigger__);
2402
+ // TODO use hide tree to improve
2403
+ mountLoopAll(renderDispatch, root);
2404
+ }
2353
2405
  }
2354
2406
  else {
2355
2407
  throw new Error("[@my-react/reconciler] should not process async load list on sync mount without enableAsyncLoad, you may use a wrong renderDispatch instance");
@@ -2792,6 +2844,9 @@ function requireIndex_development () {
2792
2844
  var baseState = Object.assign({}, fiber.pendingState);
2793
2845
  var baseProps = Object.assign({}, typedInstance.props);
2794
2846
  var pendingState = Object.assign({}, fiber.pendingState);
2847
+ if (enableDebugFiled$8.current && enableDebugUpdateQueue.current) {
2848
+ typedFiber._debugLatestUpdateQueue = new ListTree();
2849
+ }
2795
2850
  if (enableTaskPriority && allQueue.some(function (l) { return l.isSync; })) {
2796
2851
  var _loop_1 = function () {
2797
2852
  var updater = node.value;
@@ -2824,8 +2879,9 @@ function requireIndex_development () {
2824
2879
  typedNode._debugBaseValue = baseState;
2825
2880
  typedNode._debugAfterValue = fiber.pendingState;
2826
2881
  if (enableDebugUpdateQueue.current) {
2827
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
2882
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
2828
2883
  typedFiber._debugUpdateQueue.push(typedNode);
2884
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
2829
2885
  }
2830
2886
  }
2831
2887
  }
@@ -2844,8 +2900,9 @@ function requireIndex_development () {
2844
2900
  typedNode._debugBaseValue = baseState;
2845
2901
  typedNode._debugAfterValue = fiber.pendingState;
2846
2902
  if (enableDebugUpdateQueue.current) {
2847
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
2903
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
2848
2904
  typedFiber._debugUpdateQueue.push(typedNode);
2905
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
2849
2906
  }
2850
2907
  }
2851
2908
  }
@@ -2905,8 +2962,9 @@ function requireIndex_development () {
2905
2962
  typedNode._debugBaseValue = baseState;
2906
2963
  typedNode._debugAfterValue = fiber.pendingState;
2907
2964
  if (enableDebugUpdateQueue.current) {
2908
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
2965
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
2909
2966
  typedFiber._debugUpdateQueue.push(typedNode);
2967
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
2910
2968
  }
2911
2969
  }
2912
2970
  }
@@ -2925,8 +2983,9 @@ function requireIndex_development () {
2925
2983
  typedNode._debugBaseValue = baseState;
2926
2984
  typedNode._debugAfterValue = fiber.pendingState;
2927
2985
  if (enableDebugUpdateQueue.current) {
2928
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
2986
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
2929
2987
  typedFiber._debugUpdateQueue.push(typedNode);
2988
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
2930
2989
  }
2931
2990
  }
2932
2991
  }
@@ -2971,6 +3030,9 @@ function requireIndex_development () {
2971
3030
  var baseState = Object.assign({}, fiber.pendingState);
2972
3031
  var baseProps = Object.assign({}, typedInstance.props);
2973
3032
  var pendingState = Object.assign({}, fiber.pendingState);
3033
+ if (enableDebugFiled$8.current && enableDebugUpdateQueue.current) {
3034
+ typedFiber._debugLatestUpdateQueue = new ListTree();
3035
+ }
2974
3036
  if (node) {
2975
3037
  var updater = node.value;
2976
3038
  if (updater.type === UpdateQueueType.component) {
@@ -3000,8 +3062,9 @@ function requireIndex_development () {
3000
3062
  typedNode._debugBaseValue = baseState;
3001
3063
  typedNode._debugAfterValue = fiber.pendingState;
3002
3064
  if (enableDebugUpdateQueue.current) {
3003
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3065
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3004
3066
  typedFiber._debugUpdateQueue.push(typedNode);
3067
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3005
3068
  }
3006
3069
  }
3007
3070
  }
@@ -3020,8 +3083,9 @@ function requireIndex_development () {
3020
3083
  typedNode._debugBaseValue = baseState;
3021
3084
  typedNode._debugAfterValue = fiber.pendingState;
3022
3085
  if (enableDebugUpdateQueue.current) {
3023
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3086
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3024
3087
  typedFiber._debugUpdateQueue.push(typedNode);
3088
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3025
3089
  }
3026
3090
  }
3027
3091
  }
@@ -3064,6 +3128,9 @@ function requireIndex_development () {
3064
3128
  var isRetrigger = false;
3065
3129
  var processedNodes = [];
3066
3130
  var callbacks = [];
3131
+ if (enableDebugFiled$8.current && enableDebugUpdateQueue.current) {
3132
+ typedFiber._debugLatestUpdateQueue = new ListTree();
3133
+ }
3067
3134
  if (enableTaskPriority && allQueue.some(function (l) { return l.isSync; })) {
3068
3135
  var _loop_3 = function () {
3069
3136
  var updater = node.value;
@@ -3109,9 +3176,10 @@ function requireIndex_development () {
3109
3176
  typedNode._debugBeforeValue = lastResult_1;
3110
3177
  typedNode._debugAfterValue = typedTrigger_1.result;
3111
3178
  if (enableDebugUpdateQueue.current) {
3112
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3179
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3113
3180
  typedFiber._debugUpdateQueue.push(typedNode);
3114
- typedTrigger_1._debugUpdateQueue = typedTrigger_1._debugUpdateQueue || new ListTree();
3181
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3182
+ typedTrigger_1._debugUpdateQueue = typedTrigger_1._debugUpdateQueue || new ListTree(10);
3115
3183
  typedTrigger_1._debugUpdateQueue.push(typedNode);
3116
3184
  }
3117
3185
  }
@@ -3132,8 +3200,9 @@ function requireIndex_development () {
3132
3200
  typedNode._debugBeforeValue = undefined;
3133
3201
  typedNode._debugAfterValue = payLoad;
3134
3202
  if (enableDebugUpdateQueue.current) {
3135
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3203
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3136
3204
  typedFiber._debugUpdateQueue.push(typedNode);
3205
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3137
3206
  }
3138
3207
  }
3139
3208
  }
@@ -3207,9 +3276,10 @@ function requireIndex_development () {
3207
3276
  typedNode._debugBeforeValue = lastResult_2;
3208
3277
  typedNode._debugAfterValue = typedTrigger_2.result;
3209
3278
  if (enableDebugUpdateQueue.current) {
3210
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3279
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3211
3280
  typedFiber._debugUpdateQueue.push(typedNode);
3212
- typedTrigger_2._debugUpdateQueue = typedTrigger_2._debugUpdateQueue || new ListTree();
3281
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3282
+ typedTrigger_2._debugUpdateQueue = typedTrigger_2._debugUpdateQueue || new ListTree(10);
3213
3283
  typedTrigger_2._debugUpdateQueue.push(typedNode);
3214
3284
  }
3215
3285
  }
@@ -3230,8 +3300,9 @@ function requireIndex_development () {
3230
3300
  typedNode._debugBeforeValue = undefined;
3231
3301
  typedNode._debugAfterValue = payLoad;
3232
3302
  if (enableDebugUpdateQueue.current) {
3233
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3303
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3234
3304
  typedFiber._debugUpdateQueue.push(typedNode);
3305
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3235
3306
  }
3236
3307
  }
3237
3308
  }
@@ -3274,6 +3345,9 @@ function requireIndex_development () {
3274
3345
  var isRetrigger = false;
3275
3346
  var processedNodes = [];
3276
3347
  var callbacks = [];
3348
+ if (enableDebugFiled$8.current && enableDebugUpdateQueue.current) {
3349
+ typedFiber._debugLatestUpdateQueue = new ListTree();
3350
+ }
3277
3351
  if (node) {
3278
3352
  var updater = node.value;
3279
3353
  if (updater.type === UpdateQueueType.hook) {
@@ -3317,9 +3391,10 @@ function requireIndex_development () {
3317
3391
  typedNode._debugBeforeValue = lastResult_3;
3318
3392
  typedNode._debugAfterValue = typedTrigger_3.result;
3319
3393
  if (enableDebugUpdateQueue.current) {
3320
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3394
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3321
3395
  typedFiber._debugUpdateQueue.push(typedNode);
3322
- typedTrigger_3._debugUpdateQueue = typedTrigger_3._debugUpdateQueue || new ListTree();
3396
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3397
+ typedTrigger_3._debugUpdateQueue = typedTrigger_3._debugUpdateQueue || new ListTree(10);
3323
3398
  typedTrigger_3._debugUpdateQueue.push(typedNode);
3324
3399
  }
3325
3400
  }
@@ -3340,8 +3415,9 @@ function requireIndex_development () {
3340
3415
  typedNode._debugBeforeValue = undefined;
3341
3416
  typedNode._debugAfterValue = payLoad;
3342
3417
  if (enableDebugUpdateQueue.current) {
3343
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3418
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3344
3419
  typedFiber._debugUpdateQueue.push(typedNode);
3420
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3345
3421
  }
3346
3422
  }
3347
3423
  }
@@ -3379,6 +3455,9 @@ function requireIndex_development () {
3379
3455
  var isRetrigger = false;
3380
3456
  var processedNodes = [];
3381
3457
  var callbacks = [];
3458
+ if (enableDebugFiled$8.current && enableDebugUpdateQueue.current) {
3459
+ typedFiber._debugLatestUpdateQueue = new ListTree();
3460
+ }
3382
3461
  while (node) {
3383
3462
  var updater = node.value;
3384
3463
  var nextNode = node.next;
@@ -3396,8 +3475,9 @@ function requireIndex_development () {
3396
3475
  typedNode._debugBeforeValue = undefined;
3397
3476
  typedNode._debugAfterValue = payLoad;
3398
3477
  if (enableDebugUpdateQueue.current) {
3399
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3478
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3400
3479
  typedFiber._debugUpdateQueue.push(typedNode);
3480
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3401
3481
  }
3402
3482
  }
3403
3483
  node = nextNode;
@@ -3431,6 +3511,9 @@ function requireIndex_development () {
3431
3511
  var isRetrigger = false;
3432
3512
  var processedNodes = [];
3433
3513
  var callbacks = [];
3514
+ if (enableDebugFiled$8.current && enableDebugUpdateQueue.current) {
3515
+ typedFiber._debugLatestUpdateQueue = new ListTree();
3516
+ }
3434
3517
  if (node) {
3435
3518
  var updater = node.value;
3436
3519
  allQueue.delete(node);
@@ -3447,8 +3530,9 @@ function requireIndex_development () {
3447
3530
  typedNode._debugBeforeValue = undefined;
3448
3531
  typedNode._debugAfterValue = payLoad;
3449
3532
  if (enableDebugUpdateQueue.current) {
3450
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
3533
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
3451
3534
  typedFiber._debugUpdateQueue.push(typedNode);
3535
+ typedFiber._debugLatestUpdateQueue.push(typedNode);
3452
3536
  }
3453
3537
  }
3454
3538
  }
@@ -3666,12 +3750,11 @@ function requireIndex_development () {
3666
3750
  currentTriggerFiber.current = null;
3667
3751
  };
3668
3752
  var clearContainer = function (renderDispatch) {
3669
- var _a, _b, _c, _d;
3753
+ var _a, _b, _c;
3670
3754
  renderDispatch.pendingCommitFiberPatch = PATCH_TYPE.__initial__;
3671
3755
  (_a = renderDispatch.pendingUpdateFiberArray) === null || _a === void 0 ? void 0 : _a.clear();
3672
3756
  (_b = renderDispatch.pendingSuspenseFiberArray) === null || _b === void 0 ? void 0 : _b.clear();
3673
3757
  (_c = renderDispatch.pendingCommitFiberList) === null || _c === void 0 ? void 0 : _c.clear();
3674
- (_d = renderDispatch.pendingChangedFiberList) === null || _d === void 0 ? void 0 : _d.clear();
3675
3758
  renderDispatch.resetUpdateFlowRuntimeFiber();
3676
3759
  renderDispatch.isAppMounted = false;
3677
3760
  renderDispatch.isAppUnmounted = true;
@@ -3832,6 +3915,11 @@ function requireIndex_development () {
3832
3915
  };
3833
3916
 
3834
3917
  var globalLoop$2 = react.__my_react_internal__.globalLoop, currentScheduler$a = react.__my_react_internal__.currentScheduler;
3918
+ var clearLatestUpdateQueue = function (fiber) {
3919
+ var _a;
3920
+ var typedFiber = fiber;
3921
+ (_a = typedFiber._debugLatestUpdateQueue) === null || _a === void 0 ? void 0 : _a.clear();
3922
+ };
3835
3923
  var scheduleUpdateFromRoot = function (renderDispatch) {
3836
3924
  flushEffectCallback();
3837
3925
  var allLive = renderDispatch.pendingUpdateFiberArray.getAll().filter(function (f) { return exclude(f.state, STATE_TYPE.__unmount__); });
@@ -3845,6 +3933,7 @@ function requireIndex_development () {
3845
3933
  {
3846
3934
  safeCall(function safeCallBeforeDispatchUpdate() {
3847
3935
  renderDispatch.callOnBeforeDispatchUpdate(renderDispatch, allLive);
3936
+ allLive.forEach(clearLatestUpdateQueue);
3848
3937
  });
3849
3938
  }
3850
3939
  updateSyncFromRoot(renderDispatch);
@@ -3854,6 +3943,7 @@ function requireIndex_development () {
3854
3943
  {
3855
3944
  safeCall(function safeCallBeforeDispatchUpdate() {
3856
3945
  renderDispatch.callOnBeforeDispatchUpdate(renderDispatch, allLive);
3946
+ allLive.forEach(clearLatestUpdateQueue);
3857
3947
  });
3858
3948
  }
3859
3949
  updateConcurrentFromRoot(renderDispatch);
@@ -3913,19 +4003,17 @@ function requireIndex_development () {
3913
4003
  var enableScopeTreeLog$3 = react.__my_react_shared__.enableScopeTreeLog;
3914
4004
  function finishUpdateSyncFromRoot(renderDispatch) {
3915
4005
  var commitList = renderDispatch.pendingCommitFiberList;
3916
- var changedList = renderDispatch.pendingChangedFiberList;
3917
4006
  renderDispatch.resetUpdateFlowRuntimeFiber();
3918
4007
  renderDispatch.pendingCommitFiberList = null;
3919
- renderDispatch.pendingChangedFiberList = null;
3920
4008
  enableScopeTreeLog$3.current && setLogScope();
3921
4009
  (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList, true);
3922
4010
  enableScopeTreeLog$3.current && resetLogScope();
3923
4011
  safeCall(function safeCallAfterDispatchUpdate() {
3924
4012
  renderDispatch.callOnAfterDispatchUpdate(renderDispatch);
3925
4013
  });
3926
- (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
4014
+ (commitList === null || commitList === void 0 ? void 0 : commitList.length) &&
3927
4015
  safeCall(function safeCallFiberHasChangeListener() {
3928
- renderDispatch.callOnFiberChange(changedList);
4016
+ renderDispatch.callOnFiberChange(commitList);
3929
4017
  });
3930
4018
  }
3931
4019
  var updateSyncFromRoot = function (renderDispatch) {
@@ -3943,19 +4031,17 @@ function requireIndex_development () {
3943
4031
  };
3944
4032
  function finishUpdateConcurrentFromRoot(renderDispatch) {
3945
4033
  var commitList = renderDispatch.pendingCommitFiberList;
3946
- var changedList = renderDispatch.pendingChangedFiberList;
3947
4034
  renderDispatch.resetUpdateFlowRuntimeFiber();
3948
4035
  renderDispatch.pendingCommitFiberList = null;
3949
- renderDispatch.pendingChangedFiberList = null;
3950
4036
  enableScopeTreeLog$3.current && setLogScope();
3951
4037
  (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList);
3952
4038
  enableScopeTreeLog$3.current && setLogScope();
3953
4039
  safeCall(function safeCallAfterDispatchUpdate() {
3954
4040
  renderDispatch.callOnAfterDispatchUpdate(renderDispatch);
3955
4041
  });
3956
- (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
4042
+ (commitList === null || commitList === void 0 ? void 0 : commitList.length) &&
3957
4043
  safeCall(function safeCallFiberHasChangeListener() {
3958
- renderDispatch.callOnFiberChange(changedList);
4044
+ renderDispatch.callOnFiberChange(commitList);
3959
4045
  });
3960
4046
  }
3961
4047
  function checkNextFiberIsSync(renderDispatch) {
@@ -4984,7 +5070,6 @@ function requireIndex_development () {
4984
5070
  renderDispatch.runtimeMap.effectMap.delete(fiber);
4985
5071
  renderDispatch.runtimeMap.layoutEffectMap.delete(fiber);
4986
5072
  renderDispatch.runtimeMap.unmountMap.delete(fiber);
4987
- renderDispatch.runtimeMap.eventMap.delete(fiber);
4988
5073
  renderDispatch.runtimeMap.triggerCallbackMap.delete(fiber);
4989
5074
  if (Boolean(true) === false) {
4990
5075
  // fiber.child = null;
@@ -5049,7 +5134,6 @@ function requireIndex_development () {
5049
5134
  renderDispatch.pendingUnmount(parentFiber, f);
5050
5135
  });
5051
5136
  });
5052
- renderDispatch.generateChangedList(parentFiber, true);
5053
5137
  }
5054
5138
  };
5055
5139
  var getNewFiberWithUpdate = function (renderDispatch, newChild, parentFiber, existingChildren, prevFiberChild, index) {
@@ -5063,11 +5147,9 @@ function requireIndex_development () {
5063
5147
  // same type
5064
5148
  if (include(draftFiber_1 === null || draftFiber_1 === void 0 ? void 0 : draftFiber_1.type, exports.NODE_TYPE.__fragment__)) {
5065
5149
  var newElement = react.createElement(Fragment, dynamicFragmentProps, newChild);
5066
- draftFiber_1 !== prevFiberChild && renderDispatch.generateChangedList(parentFiber);
5067
5150
  return updateFiberNode(renderDispatch, { fiber: draftFiber_1, parent: parentFiber, prevFiber: prevFiberChild }, newElement);
5068
5151
  }
5069
5152
  else {
5070
- draftFiber_1 && renderDispatch.generateChangedList(parentFiber);
5071
5153
  draftFiber_1 && renderDispatch.pendingUnmount(parentFiber, draftFiber_1);
5072
5154
  return createFragmentWithUpdate(renderDispatch, newChild, parentFiber);
5073
5155
  }
@@ -5080,12 +5162,10 @@ function requireIndex_development () {
5080
5162
  }
5081
5163
  var isSameType = getIsSameTypeNode(newChild, draftFiber);
5082
5164
  if (isSameType) {
5083
- draftFiber !== prevFiberChild && renderDispatch.generateChangedList(parentFiber);
5084
5165
  return updateFiberNode(renderDispatch, { fiber: draftFiber, parent: parentFiber, prevFiber: prevFiberChild }, newChild);
5085
5166
  }
5086
5167
  else {
5087
5168
  draftFiber && renderDispatch.pendingUnmount(parentFiber, draftFiber);
5088
- draftFiber && renderDispatch.generateChangedList(parentFiber);
5089
5169
  return createFiberNode(renderDispatch, { parent: parentFiber, type: "position" }, newChild);
5090
5170
  }
5091
5171
  };
@@ -5137,7 +5217,6 @@ function requireIndex_development () {
5137
5217
  deleteIfNeed(renderDispatch, parentFiber, existingChildrenMap);
5138
5218
  }
5139
5219
  else {
5140
- renderDispatch.generateChangedList(parentFiber);
5141
5220
  var existingChildrenMap = getExistingChildren(parentFiber).existingChildrenMap;
5142
5221
  deleteIfNeed(renderDispatch, parentFiber, existingChildrenMap);
5143
5222
  var typedParentFiber = parentFiber;
@@ -5755,8 +5834,10 @@ function requireIndex_development () {
5755
5834
  updater._debugRunTime = now;
5756
5835
  updater._debugType = UpdateQueueType[UpdateQueueType.context];
5757
5836
  if (enableDebugUpdateQueue.current) {
5758
- typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree();
5837
+ typedFiber._debugUpdateQueue = typedFiber._debugUpdateQueue || new ListTree(10);
5759
5838
  typedFiber._debugUpdateQueue.push(updater);
5839
+ typedFiber._debugLatestUpdateQueue = new ListTree();
5840
+ typedFiber._debugLatestUpdateQueue.push(updater);
5760
5841
  }
5761
5842
  }
5762
5843
  processedNodes.push(updater);
@@ -6175,7 +6256,6 @@ function requireIndex_development () {
6175
6256
  layoutEffectMap: new MyWeakMap(),
6176
6257
  insertionEffectMap: new MyWeakMap(),
6177
6258
  unmountMap: new MyWeakMap(),
6178
- eventMap: new MyWeakMap(),
6179
6259
  triggerCallbackMap: new MyWeakMap(),
6180
6260
  }); };
6181
6261
  var getInitialFiber = function () { return ({
@@ -6931,13 +7011,12 @@ function requireIndex_development () {
6931
7011
  _this.isAppMounted = false;
6932
7012
  _this.isAppCrashed = false;
6933
7013
  _this.isAppUnmounted = false;
6934
- _this.version = "0.3.21";
7014
+ _this.version = "0.3.22";
6935
7015
  _this.id = Math.random().toString(16).slice(2);
6936
7016
  _this.mode = "development" ;
6937
7017
  _this.renderMode = "render";
6938
7018
  _this.pendingCommitFiberList = null;
6939
7019
  _this.pendingCommitFiberPatch = PATCH_TYPE.__initial__;
6940
- _this.pendingChangedFiberList = null;
6941
7020
  _this.pendingUpdateFiberArray = new UniqueArray();
6942
7021
  _this.pendingSuspenseFiberArray = new UniqueArray();
6943
7022
  _this.uniqueIdCount = 0;
@@ -6955,17 +7034,6 @@ function requireIndex_development () {
6955
7034
  this.pendingCommitFiberList.push(_fiber);
6956
7035
  }
6957
7036
  };
6958
- CustomRenderDispatch.prototype.generateChangedList = function (_fiber, withCheck) {
6959
- if (!_fiber)
6960
- return;
6961
- if (!this.isAppMounted)
6962
- return;
6963
- this.pendingChangedFiberList = this.pendingChangedFiberList || new ListTree();
6964
- if (withCheck && this.pendingChangedFiberList.hasValue(_fiber)) {
6965
- return;
6966
- }
6967
- this.pendingChangedFiberList.push(_fiber);
6968
- };
6969
7037
  CustomRenderDispatch.prototype.pendingCreate = function (_fiber) {
6970
7038
  if (include(_fiber.type, this.runtimeRef.typeForCreate)) {
6971
7039
  _fiber.patch = merge(_fiber.patch, PATCH_TYPE.__create__);
@@ -7151,18 +7219,9 @@ function requireIndex_development () {
7151
7219
  function finishMountSync(renderDispatch, fiber) {
7152
7220
  enableScopeTreeLog.current && setLogScope();
7153
7221
  renderDispatch.reconcileCommit(fiber);
7154
- var changedList = renderDispatch.pendingChangedFiberList;
7155
7222
  renderDispatch.resetUpdateFlowRuntimeFiber();
7156
7223
  renderDispatch.pendingCommitFiberList = null;
7157
- renderDispatch.pendingChangedFiberList = null;
7158
7224
  enableScopeTreeLog.current && resetLogScope();
7159
- (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
7160
- safeCallWithCurrentFiber({
7161
- fiber: fiber,
7162
- action: function safeCallFiberHasChangeListener() {
7163
- renderDispatch.callOnFiberChange(changedList);
7164
- },
7165
- });
7166
7225
  }
7167
7226
  var mountSync = function (renderDispatch, fiber) {
7168
7227
  safeCall(function safeCallBeforeDispatchRender() {
@@ -7182,18 +7241,9 @@ function requireIndex_development () {
7182
7241
  function finishMountAsync(renderDispatch, fiber) {
7183
7242
  enableScopeTreeLog.current && setLogScope();
7184
7243
  renderDispatch.reconcileCommit(fiber);
7185
- var changedList = renderDispatch.pendingChangedFiberList;
7186
7244
  renderDispatch.resetUpdateFlowRuntimeFiber();
7187
7245
  renderDispatch.pendingCommitFiberList = null;
7188
- renderDispatch.pendingChangedFiberList = null;
7189
7246
  enableScopeTreeLog.current && resetLogScope();
7190
- (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
7191
- safeCallWithCurrentFiber({
7192
- fiber: fiber,
7193
- action: function safeCallFiberHasChangeListener() {
7194
- renderDispatch.callOnFiberChange(changedList);
7195
- },
7196
- });
7197
7247
  }
7198
7248
  var mountAsync = function (renderDispatch, fiber) { return __awaiter(void 0, void 0, void 0, function () {
7199
7249
  return __generator(this, function (_a) {
@@ -7219,7 +7269,7 @@ function requireIndex_development () {
7219
7269
  });
7220
7270
  }); };
7221
7271
 
7222
- var version = "0.3.21";
7272
+ var version = "0.3.22";
7223
7273
 
7224
7274
  exports.CustomRenderDispatch = CustomRenderDispatch;
7225
7275
  exports.MyReactFiberNode = MyReactFiberNode;
@@ -7526,8 +7576,10 @@ var ListTreeNode = /** @class */ (function () {
7526
7576
  return ListTreeNode;
7527
7577
  }());
7528
7578
  var ListTree = /** @class */ (function () {
7529
- function ListTree() {
7579
+ function ListTree(max) {
7530
7580
  this.length = 0;
7581
+ this.maxLength = Infinity;
7582
+ this.maxLength = max || Infinity;
7531
7583
  var _stickyHead = null;
7532
7584
  Object.defineProperty(this, "stickyHead", {
7533
7585
  get: function () {
@@ -7566,6 +7618,9 @@ var ListTree = /** @class */ (function () {
7566
7618
  });
7567
7619
  }
7568
7620
  ListTree.prototype.push = function (node) {
7621
+ while (this.length >= this.maxLength) {
7622
+ this.pop();
7623
+ }
7569
7624
  var listNode = new ListTreeNode(node);
7570
7625
  this.length++;
7571
7626
  if (!this.foot) {
@@ -7583,6 +7638,7 @@ var ListTree = /** @class */ (function () {
7583
7638
  var node_1 = this.stickyFoot;
7584
7639
  this.push(node_1.value);
7585
7640
  this.stickyFoot = null;
7641
+ this.length--;
7586
7642
  }
7587
7643
  else {
7588
7644
  this.length++;
@@ -7595,6 +7651,7 @@ var ListTree = /** @class */ (function () {
7595
7651
  var node_2 = this.stickyHead;
7596
7652
  this.unshift(node_2.value);
7597
7653
  this.stickyHead = null;
7654
+ this.length--;
7598
7655
  }
7599
7656
  else {
7600
7657
  this.length++;
@@ -7613,6 +7670,9 @@ var ListTree = /** @class */ (function () {
7613
7670
  }
7614
7671
  };
7615
7672
  ListTree.prototype.unshift = function (node) {
7673
+ while (this.length >= this.maxLength) {
7674
+ this.shift();
7675
+ }
7616
7676
  var listNode = new ListTreeNode(node);
7617
7677
  this.length++;
7618
7678
  if (!this.head) {
@@ -7630,6 +7690,7 @@ var ListTree = /** @class */ (function () {
7630
7690
  var node_3 = this.stickyHead;
7631
7691
  this.unshift(node_3.value);
7632
7692
  this.stickyHead = null;
7693
+ this.length--;
7633
7694
  }
7634
7695
  else {
7635
7696
  this.length++;
@@ -7642,6 +7703,7 @@ var ListTree = /** @class */ (function () {
7642
7703
  var node_4 = this.stickyFoot;
7643
7704
  this.push(node_4.value);
7644
7705
  this.stickyFoot = null;
7706
+ this.length--;
7645
7707
  }
7646
7708
  else {
7647
7709
  this.length++;
@@ -7793,7 +7855,7 @@ var ListTree = /** @class */ (function () {
7793
7855
  return newList;
7794
7856
  };
7795
7857
  ListTree.prototype.clone = function () {
7796
- var newList = new ListTree();
7858
+ var newList = new ListTree(this.maxLength);
7797
7859
  this.listToFoot(function (v) { return newList.push(v); });
7798
7860
  return newList;
7799
7861
  };
@@ -7814,6 +7876,38 @@ var ListTree = /** @class */ (function () {
7814
7876
  });
7815
7877
  }
7816
7878
 
7879
+ var enableKnownConfigLog = require$$0.createRef(false);
7880
+ var knownConfigKeys = [
7881
+ "prepareForCommit",
7882
+ "resetAfterCommit",
7883
+ "appendChildToContainer",
7884
+ "appendInitialChild",
7885
+ "appendChild",
7886
+ "shouldSetTextContent",
7887
+ "createTextInstance",
7888
+ "createInstance",
7889
+ "preparePortalMount",
7890
+ "insertInContainerBefore",
7891
+ "insertBefore",
7892
+ "getPublicInstance",
7893
+ "removeChildFromContainer",
7894
+ "removeChild",
7895
+ "commitTextUpdate",
7896
+ "prepareUpdate",
7897
+ "commitUpdate",
7898
+ "getRootHostContext",
7899
+ "getChildHostContext",
7900
+ "finalizeInitialChildren",
7901
+ "commitMount",
7902
+ ];
7903
+ var knownConfig = function (config) {
7904
+ Object.keys(config).forEach(function (key) {
7905
+ if (!knownConfigKeys.includes(key)) {
7906
+ console.warn("not used config key ".concat(key, " with %o value"), config[key]);
7907
+ }
7908
+ });
7909
+ };
7910
+
7817
7911
  var DISPATCH_FIELD = "__@my-react/dispatch__";
7818
7912
  var DEV_TOOL_FIELD = "__@my-react/react-devtool-inject__";
7819
7913
  var addGlobalDispatch = function (dispatch) {
@@ -9079,6 +9173,9 @@ var currentScheduler = require$$0.__my_react_internal__.currentScheduler;
9079
9173
  var Reconciler = function (_config) {
9080
9174
  var rendererPackageName = "@my-react";
9081
9175
  var ReconcilerSet = new Set();
9176
+ if (enableKnownConfigLog.current) {
9177
+ knownConfig(_config);
9178
+ }
9082
9179
  var createContainer = function (_container, flag) {
9083
9180
  prepareScheduler();
9084
9181
  if (flag === 0) {
@@ -9090,6 +9187,7 @@ var Reconciler = function (_config) {
9090
9187
  _container.__flag__ = 1;
9091
9188
  }
9092
9189
  enableDebugFiled.current = true;
9190
+ myreactReconcilerExports.enableDebugUpdateQueue.current = true;
9093
9191
  enableScopeTreeLog.current = false;
9094
9192
  myreactReconcilerExports.enableFiberForLog.current = false;
9095
9193
  return _container;
@@ -9185,14 +9283,16 @@ var Reconciler = function (_config) {
9185
9283
  getPublicRootInstance: getPublicRootInstance,
9186
9284
  injectIntoDevToolsWithSocketIO: injectIntoDevToolsWithSocketIO,
9187
9285
  flushSync: myreactReconcilerExports.safeCallWithSync,
9286
+ flushSyncWork: myreactReconcilerExports.safeCallWithSync,
9188
9287
  batchedUpdates: myreactReconcilerExports.safeCallWithSync,
9189
9288
  };
9190
9289
  };
9191
9290
 
9192
9291
  /* eslint-disable import/export */
9193
- var version = "0.0.12";
9292
+ var version = "0.0.13";
9194
9293
  var createReconciler = Reconciler;
9195
9294
 
9196
9295
  exports.createReconciler = createReconciler;
9197
9296
  exports.default = createReconciler;
9297
+ exports.enableKnownConfigLog = enableKnownConfigLog;
9198
9298
  exports.version = version;