1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';
|
11 |
|
12 |
|
13 |
|
14 | if (process.env.NODE_ENV !== "production") {
|
15 | (function() {
|
16 | 'use strict';
|
17 |
|
18 | var _assign = require('object-assign');
|
19 | var React = require('react');
|
20 | var Transform = require('art/core/transform');
|
21 | var Mode = require('art/modes/current');
|
22 | var checkPropTypes = require('prop-types/checkPropTypes');
|
23 | var Scheduler = require('scheduler');
|
24 | var tracing = require('scheduler/tracing');
|
25 | var FastNoSideEffects = require('art/modes/fast-noSideEffects');
|
26 |
|
27 |
|
28 |
|
29 | var ReactVersion = '16.9.0-rc.0';
|
30 |
|
31 | var LegacyRoot = 0;
|
32 | var BatchedRoot = 1;
|
33 | var ConcurrentRoot = 2;
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | function ReactError(error) {
|
44 | error.name = 'Invariant Violation';
|
45 | return error;
|
46 | }
|
47 |
|
48 | var FunctionComponent = 0;
|
49 | var ClassComponent = 1;
|
50 | var IndeterminateComponent = 2;
|
51 | var HostRoot = 3;
|
52 | var HostPortal = 4;
|
53 | var HostComponent = 5;
|
54 | var HostText = 6;
|
55 | var Fragment = 7;
|
56 | var Mode$1 = 8;
|
57 | var ContextConsumer = 9;
|
58 | var ContextProvider = 10;
|
59 | var ForwardRef = 11;
|
60 | var Profiler = 12;
|
61 | var SuspenseComponent = 13;
|
62 | var MemoComponent = 14;
|
63 | var SimpleMemoComponent = 15;
|
64 | var LazyComponent = 16;
|
65 | var IncompleteClassComponent = 17;
|
66 | var DehydratedSuspenseComponent = 18;
|
67 | var SuspenseListComponent = 19;
|
68 | var FundamentalComponent = 20;
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | var warningWithoutStack = function () {};
|
89 |
|
90 | {
|
91 | warningWithoutStack = function (condition, format) {
|
92 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
93 | args[_key - 2] = arguments[_key];
|
94 | }
|
95 |
|
96 | if (format === undefined) {
|
97 | throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
98 | }
|
99 | if (args.length > 8) {
|
100 |
|
101 | throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
102 | }
|
103 | if (condition) {
|
104 | return;
|
105 | }
|
106 | if (typeof console !== 'undefined') {
|
107 | var argsWithFormat = args.map(function (item) {
|
108 | return '' + item;
|
109 | });
|
110 | argsWithFormat.unshift('Warning: ' + format);
|
111 |
|
112 |
|
113 |
|
114 | Function.prototype.apply.call(console.error, console, argsWithFormat);
|
115 | }
|
116 | try {
|
117 |
|
118 |
|
119 |
|
120 | var argIndex = 0;
|
121 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
122 | return args[argIndex++];
|
123 | });
|
124 | throw new Error(message);
|
125 | } catch (x) {}
|
126 | };
|
127 | }
|
128 |
|
129 | var warningWithoutStack$1 = warningWithoutStack;
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 | function get(key) {
|
149 | return key._reactInternalFiber;
|
150 | }
|
151 |
|
152 |
|
153 |
|
154 | function set(key, value) {
|
155 | key._reactInternalFiber = value;
|
156 | }
|
157 |
|
158 | var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
164 | ReactSharedInternals.ReactCurrentDispatcher = {
|
165 | current: null
|
166 | };
|
167 | }
|
168 | if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
169 | ReactSharedInternals.ReactCurrentBatchConfig = {
|
170 | suspense: null
|
171 | };
|
172 | }
|
173 |
|
174 |
|
175 |
|
176 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
177 |
|
178 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
179 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
180 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
181 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
182 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
183 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
184 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
185 |
|
186 |
|
187 |
|
188 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
189 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
190 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
191 | var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
192 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
193 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
194 | var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
195 | var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
196 |
|
197 | var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
198 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
199 |
|
200 | function getIteratorFn(maybeIterable) {
|
201 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
202 | return null;
|
203 | }
|
204 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
205 | if (typeof maybeIterator === 'function') {
|
206 | return maybeIterator;
|
207 | }
|
208 | return null;
|
209 | }
|
210 |
|
211 | var Pending = 0;
|
212 | var Resolved = 1;
|
213 | var Rejected = 2;
|
214 |
|
215 | function refineResolvedLazyComponent(lazyComponent) {
|
216 | return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
217 | }
|
218 |
|
219 | function getWrappedName(outerType, innerType, wrapperName) {
|
220 | var functionName = innerType.displayName || innerType.name || '';
|
221 | return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
222 | }
|
223 |
|
224 | function getComponentName(type) {
|
225 | if (type == null) {
|
226 |
|
227 | return null;
|
228 | }
|
229 | {
|
230 | if (typeof type.tag === 'number') {
|
231 | warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
232 | }
|
233 | }
|
234 | if (typeof type === 'function') {
|
235 | return type.displayName || type.name || null;
|
236 | }
|
237 | if (typeof type === 'string') {
|
238 | return type;
|
239 | }
|
240 | switch (type) {
|
241 | case REACT_FRAGMENT_TYPE:
|
242 | return 'Fragment';
|
243 | case REACT_PORTAL_TYPE:
|
244 | return 'Portal';
|
245 | case REACT_PROFILER_TYPE:
|
246 | return 'Profiler';
|
247 | case REACT_STRICT_MODE_TYPE:
|
248 | return 'StrictMode';
|
249 | case REACT_SUSPENSE_TYPE:
|
250 | return 'Suspense';
|
251 | case REACT_SUSPENSE_LIST_TYPE:
|
252 | return 'SuspenseList';
|
253 | }
|
254 | if (typeof type === 'object') {
|
255 | switch (type.$$typeof) {
|
256 | case REACT_CONTEXT_TYPE:
|
257 | return 'Context.Consumer';
|
258 | case REACT_PROVIDER_TYPE:
|
259 | return 'Context.Provider';
|
260 | case REACT_FORWARD_REF_TYPE:
|
261 | return getWrappedName(type, type.render, 'ForwardRef');
|
262 | case REACT_MEMO_TYPE:
|
263 | return getComponentName(type.type);
|
264 | case REACT_LAZY_TYPE:
|
265 | {
|
266 | var thenable = type;
|
267 | var resolvedThenable = refineResolvedLazyComponent(thenable);
|
268 | if (resolvedThenable) {
|
269 | return getComponentName(resolvedThenable);
|
270 | }
|
271 | break;
|
272 | }
|
273 | }
|
274 | }
|
275 | return null;
|
276 | }
|
277 |
|
278 |
|
279 | var NoEffect = 0;
|
280 | var PerformedWork = 1;
|
281 |
|
282 |
|
283 | var Placement = 2;
|
284 | var Update = 4;
|
285 | var PlacementAndUpdate = 6;
|
286 | var Deletion = 8;
|
287 | var ContentReset = 16;
|
288 | var Callback = 32;
|
289 | var DidCapture = 64;
|
290 | var Ref = 128;
|
291 | var Snapshot = 256;
|
292 | var Passive = 512;
|
293 |
|
294 |
|
295 | var LifecycleEffectMask = 932;
|
296 |
|
297 |
|
298 | var HostEffectMask = 1023;
|
299 |
|
300 | var Incomplete = 1024;
|
301 | var ShouldCapture = 2048;
|
302 |
|
303 | var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
304 |
|
305 | var MOUNTING = 1;
|
306 | var MOUNTED = 2;
|
307 | var UNMOUNTED = 3;
|
308 |
|
309 | function isFiberMountedImpl(fiber) {
|
310 | var node = fiber;
|
311 | if (!fiber.alternate) {
|
312 |
|
313 |
|
314 | if ((node.effectTag & Placement) !== NoEffect) {
|
315 | return MOUNTING;
|
316 | }
|
317 | while (node.return) {
|
318 | node = node.return;
|
319 | if ((node.effectTag & Placement) !== NoEffect) {
|
320 | return MOUNTING;
|
321 | }
|
322 | }
|
323 | } else {
|
324 | while (node.return) {
|
325 | node = node.return;
|
326 | }
|
327 | }
|
328 | if (node.tag === HostRoot) {
|
329 |
|
330 |
|
331 | return MOUNTED;
|
332 | }
|
333 |
|
334 |
|
335 | return UNMOUNTED;
|
336 | }
|
337 |
|
338 | function isFiberMounted(fiber) {
|
339 | return isFiberMountedImpl(fiber) === MOUNTED;
|
340 | }
|
341 |
|
342 | function isMounted(component) {
|
343 | {
|
344 | var owner = ReactCurrentOwner.current;
|
345 | if (owner !== null && owner.tag === ClassComponent) {
|
346 | var ownerFiber = owner;
|
347 | var instance = ownerFiber.stateNode;
|
348 | !instance._warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component') : void 0;
|
349 | instance._warnedAboutRefsInRender = true;
|
350 | }
|
351 | }
|
352 |
|
353 | var fiber = get(component);
|
354 | if (!fiber) {
|
355 | return false;
|
356 | }
|
357 | return isFiberMountedImpl(fiber) === MOUNTED;
|
358 | }
|
359 |
|
360 | function assertIsMounted(fiber) {
|
361 | (function () {
|
362 | if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
|
363 | {
|
364 | throw ReactError(Error('Unable to find node on an unmounted component.'));
|
365 | }
|
366 | }
|
367 | })();
|
368 | }
|
369 |
|
370 | function findCurrentFiberUsingSlowPath(fiber) {
|
371 | var alternate = fiber.alternate;
|
372 | if (!alternate) {
|
373 |
|
374 | var state = isFiberMountedImpl(fiber);
|
375 | (function () {
|
376 | if (!(state !== UNMOUNTED)) {
|
377 | {
|
378 | throw ReactError(Error('Unable to find node on an unmounted component.'));
|
379 | }
|
380 | }
|
381 | })();
|
382 | if (state === MOUNTING) {
|
383 | return null;
|
384 | }
|
385 | return fiber;
|
386 | }
|
387 |
|
388 |
|
389 |
|
390 | var a = fiber;
|
391 | var b = alternate;
|
392 | while (true) {
|
393 | var parentA = a.return;
|
394 | if (parentA === null) {
|
395 |
|
396 | break;
|
397 | }
|
398 | var parentB = parentA.alternate;
|
399 | if (parentB === null) {
|
400 |
|
401 |
|
402 |
|
403 |
|
404 | var nextParent = parentA.return;
|
405 | if (nextParent !== null) {
|
406 | a = b = nextParent;
|
407 | continue;
|
408 | }
|
409 |
|
410 | break;
|
411 | }
|
412 |
|
413 |
|
414 |
|
415 |
|
416 | if (parentA.child === parentB.child) {
|
417 | var child = parentA.child;
|
418 | while (child) {
|
419 | if (child === a) {
|
420 |
|
421 | assertIsMounted(parentA);
|
422 | return fiber;
|
423 | }
|
424 | if (child === b) {
|
425 |
|
426 | assertIsMounted(parentA);
|
427 | return alternate;
|
428 | }
|
429 | child = child.sibling;
|
430 | }
|
431 |
|
432 |
|
433 | (function () {
|
434 | {
|
435 | {
|
436 | throw ReactError(Error('Unable to find node on an unmounted component.'));
|
437 | }
|
438 | }
|
439 | })();
|
440 | }
|
441 |
|
442 | if (a.return !== b.return) {
|
443 |
|
444 |
|
445 |
|
446 |
|
447 | a = parentA;
|
448 | b = parentB;
|
449 | } else {
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 | var didFindChild = false;
|
456 | var _child = parentA.child;
|
457 | while (_child) {
|
458 | if (_child === a) {
|
459 | didFindChild = true;
|
460 | a = parentA;
|
461 | b = parentB;
|
462 | break;
|
463 | }
|
464 | if (_child === b) {
|
465 | didFindChild = true;
|
466 | b = parentA;
|
467 | a = parentB;
|
468 | break;
|
469 | }
|
470 | _child = _child.sibling;
|
471 | }
|
472 | if (!didFindChild) {
|
473 |
|
474 | _child = parentB.child;
|
475 | while (_child) {
|
476 | if (_child === a) {
|
477 | didFindChild = true;
|
478 | a = parentB;
|
479 | b = parentA;
|
480 | break;
|
481 | }
|
482 | if (_child === b) {
|
483 | didFindChild = true;
|
484 | b = parentB;
|
485 | a = parentA;
|
486 | break;
|
487 | }
|
488 | _child = _child.sibling;
|
489 | }
|
490 | (function () {
|
491 | if (!didFindChild) {
|
492 | {
|
493 | throw ReactError(Error('Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.'));
|
494 | }
|
495 | }
|
496 | })();
|
497 | }
|
498 | }
|
499 |
|
500 | (function () {
|
501 | if (!(a.alternate === b)) {
|
502 | {
|
503 | throw ReactError(Error('Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.'));
|
504 | }
|
505 | }
|
506 | })();
|
507 | }
|
508 |
|
509 |
|
510 | (function () {
|
511 | if (!(a.tag === HostRoot)) {
|
512 | {
|
513 | throw ReactError(Error('Unable to find node on an unmounted component.'));
|
514 | }
|
515 | }
|
516 | })();
|
517 | if (a.stateNode.current === a) {
|
518 |
|
519 | return fiber;
|
520 | }
|
521 |
|
522 | return alternate;
|
523 | }
|
524 |
|
525 | function findCurrentHostFiber(parent) {
|
526 | var currentParent = findCurrentFiberUsingSlowPath(parent);
|
527 | if (!currentParent) {
|
528 | return null;
|
529 | }
|
530 |
|
531 |
|
532 | var node = currentParent;
|
533 | while (true) {
|
534 | if (node.tag === HostComponent || node.tag === HostText) {
|
535 | return node;
|
536 | } else if (node.child) {
|
537 | node.child.return = node;
|
538 | node = node.child;
|
539 | continue;
|
540 | }
|
541 | if (node === currentParent) {
|
542 | return null;
|
543 | }
|
544 | while (!node.sibling) {
|
545 | if (!node.return || node.return === currentParent) {
|
546 | return null;
|
547 | }
|
548 | node = node.return;
|
549 | }
|
550 | node.sibling.return = node.return;
|
551 | node = node.sibling;
|
552 | }
|
553 |
|
554 |
|
555 | return null;
|
556 | }
|
557 |
|
558 | var TYPES = {
|
559 | CLIPPING_RECTANGLE: 'ClippingRectangle',
|
560 | GROUP: 'Group',
|
561 | SHAPE: 'Shape',
|
562 | TEXT: 'Text'
|
563 | };
|
564 |
|
565 | var EVENT_TYPES = {
|
566 | onClick: 'click',
|
567 | onMouseMove: 'mousemove',
|
568 | onMouseOver: 'mouseover',
|
569 | onMouseOut: 'mouseout',
|
570 | onMouseUp: 'mouseup',
|
571 | onMouseDown: 'mousedown'
|
572 | };
|
573 |
|
574 | function childrenAsString(children) {
|
575 | if (!children) {
|
576 | return '';
|
577 | } else if (typeof children === 'string') {
|
578 | return children;
|
579 | } else if (children.length) {
|
580 | return children.join('');
|
581 | } else {
|
582 | return '';
|
583 | }
|
584 | }
|
585 |
|
586 |
|
587 |
|
588 |
|
589 | function shim() {
|
590 | (function () {
|
591 | {
|
592 | {
|
593 | throw ReactError(Error('The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.'));
|
594 | }
|
595 | }
|
596 | })();
|
597 | }
|
598 |
|
599 |
|
600 | var supportsPersistence = false;
|
601 | var cloneInstance = shim;
|
602 | var cloneFundamentalInstance = shim;
|
603 | var createContainerChildSet = shim;
|
604 | var appendChildToContainerChildSet = shim;
|
605 | var finalizeContainerChildren = shim;
|
606 | var replaceContainerChildren = shim;
|
607 | var cloneHiddenInstance = shim;
|
608 | var cloneHiddenTextInstance = shim;
|
609 |
|
610 |
|
611 |
|
612 |
|
613 | function shim$1() {
|
614 | (function () {
|
615 | {
|
616 | {
|
617 | throw ReactError(Error('The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue.'));
|
618 | }
|
619 | }
|
620 | })();
|
621 | }
|
622 |
|
623 |
|
624 |
|
625 | var supportsHydration = false;
|
626 | var canHydrateInstance = shim$1;
|
627 | var canHydrateTextInstance = shim$1;
|
628 | var canHydrateSuspenseInstance = shim$1;
|
629 | var isSuspenseInstancePending = shim$1;
|
630 | var isSuspenseInstanceFallback = shim$1;
|
631 | var registerSuspenseInstanceRetry = shim$1;
|
632 | var getNextHydratableSibling = shim$1;
|
633 | var getFirstHydratableChild = shim$1;
|
634 | var hydrateInstance = shim$1;
|
635 | var hydrateTextInstance = shim$1;
|
636 | var getNextHydratableInstanceAfterSuspenseInstance = shim$1;
|
637 | var clearSuspenseBoundary = shim$1;
|
638 | var clearSuspenseBoundaryFromContainer = shim$1;
|
639 | var didNotMatchHydratedContainerTextInstance = shim$1;
|
640 | var didNotMatchHydratedTextInstance = shim$1;
|
641 | var didNotHydrateContainerInstance = shim$1;
|
642 | var didNotHydrateInstance = shim$1;
|
643 | var didNotFindHydratableContainerInstance = shim$1;
|
644 | var didNotFindHydratableContainerTextInstance = shim$1;
|
645 | var didNotFindHydratableContainerSuspenseInstance = shim$1;
|
646 | var didNotFindHydratableInstance = shim$1;
|
647 | var didNotFindHydratableTextInstance = shim$1;
|
648 | var didNotFindHydratableSuspenseInstance = shim$1;
|
649 |
|
650 | var pooledTransform = new Transform();
|
651 |
|
652 | var NO_CONTEXT = {};
|
653 | var UPDATE_SIGNAL = {};
|
654 | {
|
655 | Object.freeze(NO_CONTEXT);
|
656 | Object.freeze(UPDATE_SIGNAL);
|
657 | }
|
658 |
|
659 |
|
660 |
|
661 | function addEventListeners(instance, type, listener) {
|
662 |
|
663 |
|
664 | if (!instance._listeners) {
|
665 | instance._listeners = {};
|
666 | instance._subscriptions = {};
|
667 | }
|
668 |
|
669 | instance._listeners[type] = listener;
|
670 |
|
671 | if (listener) {
|
672 | if (!instance._subscriptions[type]) {
|
673 | instance._subscriptions[type] = instance.subscribe(type, createEventHandler(instance), instance);
|
674 | }
|
675 | } else {
|
676 | if (instance._subscriptions[type]) {
|
677 | instance._subscriptions[type]();
|
678 | delete instance._subscriptions[type];
|
679 | }
|
680 | }
|
681 | }
|
682 |
|
683 | function createEventHandler(instance) {
|
684 | return function handleEvent(event) {
|
685 | var listener = instance._listeners[event.type];
|
686 |
|
687 | if (!listener) {
|
688 |
|
689 | } else if (typeof listener === 'function') {
|
690 | listener.call(instance, event);
|
691 | } else if (listener.handleEvent) {
|
692 | listener.handleEvent(event);
|
693 | }
|
694 | };
|
695 | }
|
696 |
|
697 | function destroyEventListeners(instance) {
|
698 | if (instance._subscriptions) {
|
699 | for (var type in instance._subscriptions) {
|
700 | instance._subscriptions[type]();
|
701 | }
|
702 | }
|
703 |
|
704 | instance._subscriptions = null;
|
705 | instance._listeners = null;
|
706 | }
|
707 |
|
708 | function getScaleX(props) {
|
709 | if (props.scaleX != null) {
|
710 | return props.scaleX;
|
711 | } else if (props.scale != null) {
|
712 | return props.scale;
|
713 | } else {
|
714 | return 1;
|
715 | }
|
716 | }
|
717 |
|
718 | function getScaleY(props) {
|
719 | if (props.scaleY != null) {
|
720 | return props.scaleY;
|
721 | } else if (props.scale != null) {
|
722 | return props.scale;
|
723 | } else {
|
724 | return 1;
|
725 | }
|
726 | }
|
727 |
|
728 | function isSameFont(oldFont, newFont) {
|
729 | if (oldFont === newFont) {
|
730 | return true;
|
731 | } else if (typeof newFont === 'string' || typeof oldFont === 'string') {
|
732 | return false;
|
733 | } else {
|
734 | return newFont.fontSize === oldFont.fontSize && newFont.fontStyle === oldFont.fontStyle && newFont.fontVariant === oldFont.fontVariant && newFont.fontWeight === oldFont.fontWeight && newFont.fontFamily === oldFont.fontFamily;
|
735 | }
|
736 | }
|
737 |
|
738 |
|
739 |
|
740 | function applyClippingRectangleProps(instance, props) {
|
741 | var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
742 |
|
743 | applyNodeProps(instance, props, prevProps);
|
744 |
|
745 | instance.width = props.width;
|
746 | instance.height = props.height;
|
747 | }
|
748 |
|
749 | function applyGroupProps(instance, props) {
|
750 | var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
751 |
|
752 | applyNodeProps(instance, props, prevProps);
|
753 |
|
754 | instance.width = props.width;
|
755 | instance.height = props.height;
|
756 | }
|
757 |
|
758 | function applyNodeProps(instance, props) {
|
759 | var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
760 |
|
761 | var scaleX = getScaleX(props);
|
762 | var scaleY = getScaleY(props);
|
763 |
|
764 | pooledTransform.transformTo(1, 0, 0, 1, 0, 0).move(props.x || 0, props.y || 0).rotate(props.rotation || 0, props.originX, props.originY).scale(scaleX, scaleY, props.originX, props.originY);
|
765 |
|
766 | if (props.transform != null) {
|
767 | pooledTransform.transform(props.transform);
|
768 | }
|
769 |
|
770 | if (instance.xx !== pooledTransform.xx || instance.yx !== pooledTransform.yx || instance.xy !== pooledTransform.xy || instance.yy !== pooledTransform.yy || instance.x !== pooledTransform.x || instance.y !== pooledTransform.y) {
|
771 | instance.transformTo(pooledTransform);
|
772 | }
|
773 |
|
774 | if (props.cursor !== prevProps.cursor || props.title !== prevProps.title) {
|
775 | instance.indicate(props.cursor, props.title);
|
776 | }
|
777 |
|
778 | if (instance.blend && props.opacity !== prevProps.opacity) {
|
779 | instance.blend(props.opacity == null ? 1 : props.opacity);
|
780 | }
|
781 |
|
782 | if (props.visible !== prevProps.visible) {
|
783 | if (props.visible == null || props.visible) {
|
784 | instance.show();
|
785 | } else {
|
786 | instance.hide();
|
787 | }
|
788 | }
|
789 |
|
790 | for (var type in EVENT_TYPES) {
|
791 | addEventListeners(instance, EVENT_TYPES[type], props[type]);
|
792 | }
|
793 | }
|
794 |
|
795 | function applyRenderableNodeProps(instance, props) {
|
796 | var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
797 |
|
798 | applyNodeProps(instance, props, prevProps);
|
799 |
|
800 | if (prevProps.fill !== props.fill) {
|
801 | if (props.fill && props.fill.applyFill) {
|
802 | props.fill.applyFill(instance);
|
803 | } else {
|
804 | instance.fill(props.fill);
|
805 | }
|
806 | }
|
807 | if (prevProps.stroke !== props.stroke || prevProps.strokeWidth !== props.strokeWidth || prevProps.strokeCap !== props.strokeCap || prevProps.strokeJoin !== props.strokeJoin ||
|
808 |
|
809 | prevProps.strokeDash !== props.strokeDash) {
|
810 | instance.stroke(props.stroke, props.strokeWidth, props.strokeCap, props.strokeJoin, props.strokeDash);
|
811 | }
|
812 | }
|
813 |
|
814 | function applyShapeProps(instance, props) {
|
815 | var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
816 |
|
817 | applyRenderableNodeProps(instance, props, prevProps);
|
818 |
|
819 | var path = props.d || childrenAsString(props.children);
|
820 |
|
821 | var prevDelta = instance._prevDelta;
|
822 | var prevPath = instance._prevPath;
|
823 |
|
824 | if (path !== prevPath || path.delta !== prevDelta || prevProps.height !== props.height || prevProps.width !== props.width) {
|
825 | instance.draw(path, props.width, props.height);
|
826 |
|
827 | instance._prevDelta = path.delta;
|
828 | instance._prevPath = path;
|
829 | }
|
830 | }
|
831 |
|
832 | function applyTextProps(instance, props) {
|
833 | var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
834 |
|
835 | applyRenderableNodeProps(instance, props, prevProps);
|
836 |
|
837 | var string = props.children;
|
838 |
|
839 | if (instance._currentString !== string || !isSameFont(props.font, prevProps.font) || props.alignment !== prevProps.alignment || props.path !== prevProps.path) {
|
840 | instance.draw(string, props.font, props.alignment, props.path);
|
841 |
|
842 | instance._currentString = string;
|
843 | }
|
844 | }
|
845 |
|
846 | function appendInitialChild(parentInstance, child) {
|
847 | if (typeof child === 'string') {
|
848 |
|
849 | (function () {
|
850 | {
|
851 | {
|
852 | throw ReactError(Error('Text children should already be flattened.'));
|
853 | }
|
854 | }
|
855 | })();
|
856 | return;
|
857 | }
|
858 |
|
859 | child.inject(parentInstance);
|
860 | }
|
861 |
|
862 | function createInstance(type, props, internalInstanceHandle) {
|
863 | var instance = void 0;
|
864 |
|
865 | switch (type) {
|
866 | case TYPES.CLIPPING_RECTANGLE:
|
867 | instance = Mode.ClippingRectangle();
|
868 | instance._applyProps = applyClippingRectangleProps;
|
869 | break;
|
870 | case TYPES.GROUP:
|
871 | instance = Mode.Group();
|
872 | instance._applyProps = applyGroupProps;
|
873 | break;
|
874 | case TYPES.SHAPE:
|
875 | instance = Mode.Shape();
|
876 | instance._applyProps = applyShapeProps;
|
877 | break;
|
878 | case TYPES.TEXT:
|
879 | instance = Mode.Text(props.children, props.font, props.alignment, props.path);
|
880 | instance._applyProps = applyTextProps;
|
881 | break;
|
882 | }
|
883 |
|
884 | (function () {
|
885 | if (!instance) {
|
886 | {
|
887 | throw ReactError(Error('ReactART does not support the type "' + type + '"'));
|
888 | }
|
889 | }
|
890 | })();
|
891 |
|
892 | instance._applyProps(instance, props);
|
893 |
|
894 | return instance;
|
895 | }
|
896 |
|
897 | function createTextInstance(text, rootContainerInstance, internalInstanceHandle) {
|
898 | return text;
|
899 | }
|
900 |
|
901 | function finalizeInitialChildren(domElement, type, props) {
|
902 | return false;
|
903 | }
|
904 |
|
905 | function getPublicInstance(instance) {
|
906 | return instance;
|
907 | }
|
908 |
|
909 | function prepareForCommit() {
|
910 |
|
911 | }
|
912 |
|
913 | function prepareUpdate(domElement, type, oldProps, newProps) {
|
914 | return UPDATE_SIGNAL;
|
915 | }
|
916 |
|
917 | function resetAfterCommit() {
|
918 |
|
919 | }
|
920 |
|
921 | function resetTextContent(domElement) {
|
922 |
|
923 | }
|
924 |
|
925 | function shouldDeprioritizeSubtree(type, props) {
|
926 | return false;
|
927 | }
|
928 |
|
929 | function getRootHostContext() {
|
930 | return NO_CONTEXT;
|
931 | }
|
932 |
|
933 | function getChildHostContext() {
|
934 | return NO_CONTEXT;
|
935 | }
|
936 |
|
937 | var scheduleTimeout = setTimeout;
|
938 | var cancelTimeout = clearTimeout;
|
939 | var noTimeout = -1;
|
940 |
|
941 | function shouldSetTextContent(type, props) {
|
942 | return typeof props.children === 'string' || typeof props.children === 'number';
|
943 | }
|
944 |
|
945 |
|
946 | var isPrimaryRenderer = false;
|
947 |
|
948 |
|
949 | var warnsIfNotActing = false;
|
950 |
|
951 | var supportsMutation = true;
|
952 |
|
953 | function appendChild(parentInstance, child) {
|
954 | if (child.parentNode === parentInstance) {
|
955 | child.eject();
|
956 | }
|
957 | child.inject(parentInstance);
|
958 | }
|
959 |
|
960 | function appendChildToContainer(parentInstance, child) {
|
961 | if (child.parentNode === parentInstance) {
|
962 | child.eject();
|
963 | }
|
964 | child.inject(parentInstance);
|
965 | }
|
966 |
|
967 | function insertBefore(parentInstance, child, beforeChild) {
|
968 | (function () {
|
969 | if (!(child !== beforeChild)) {
|
970 | {
|
971 | throw ReactError(Error('ReactART: Can not insert node before itself'));
|
972 | }
|
973 | }
|
974 | })();
|
975 | child.injectBefore(beforeChild);
|
976 | }
|
977 |
|
978 | function insertInContainerBefore(parentInstance, child, beforeChild) {
|
979 | (function () {
|
980 | if (!(child !== beforeChild)) {
|
981 | {
|
982 | throw ReactError(Error('ReactART: Can not insert node before itself'));
|
983 | }
|
984 | }
|
985 | })();
|
986 | child.injectBefore(beforeChild);
|
987 | }
|
988 |
|
989 | function removeChild(parentInstance, child) {
|
990 | destroyEventListeners(child);
|
991 | child.eject();
|
992 | }
|
993 |
|
994 | function removeChildFromContainer(parentInstance, child) {
|
995 | destroyEventListeners(child);
|
996 | child.eject();
|
997 | }
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 | function commitUpdate(instance, updatePayload, type, oldProps, newProps) {
|
1004 | instance._applyProps(instance, newProps, oldProps);
|
1005 | }
|
1006 |
|
1007 | function hideInstance(instance) {
|
1008 | instance.hide();
|
1009 | }
|
1010 |
|
1011 |
|
1012 |
|
1013 | function unhideInstance(instance, props) {
|
1014 | if (props.visible == null || props.visible) {
|
1015 | instance.show();
|
1016 | }
|
1017 | }
|
1018 |
|
1019 | function unhideTextInstance(textInstance, text) {
|
1020 |
|
1021 | }
|
1022 |
|
1023 | function mountResponderInstance(responder, responderInstance, props, state, instance, rootContainerInstance) {
|
1024 | throw new Error('Not yet implemented.');
|
1025 | }
|
1026 |
|
1027 | function unmountResponderInstance(responderInstance) {
|
1028 | throw new Error('Not yet implemented.');
|
1029 | }
|
1030 |
|
1031 | function getFundamentalComponentInstance(fundamentalInstance) {
|
1032 | throw new Error('Not yet implemented.');
|
1033 | }
|
1034 |
|
1035 | function mountFundamentalComponent(fundamentalInstance) {
|
1036 | throw new Error('Not yet implemented.');
|
1037 | }
|
1038 |
|
1039 | function shouldUpdateFundamentalComponent(fundamentalInstance) {
|
1040 | throw new Error('Not yet implemented.');
|
1041 | }
|
1042 |
|
1043 | function updateFundamentalComponent(fundamentalInstance) {
|
1044 | throw new Error('Not yet implemented.');
|
1045 | }
|
1046 |
|
1047 | function unmountFundamentalComponent(fundamentalInstance) {
|
1048 | throw new Error('Not yet implemented.');
|
1049 | }
|
1050 |
|
1051 | var enableUserTimingAPI = true;
|
1052 |
|
1053 |
|
1054 | var debugRenderPhaseSideEffects = false;
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 | var debugRenderPhaseSideEffectsForStrictMode = true;
|
1061 |
|
1062 |
|
1063 |
|
1064 | var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
|
1065 |
|
1066 |
|
1067 | var warnAboutDeprecatedLifecycles = true;
|
1068 |
|
1069 |
|
1070 | var enableProfilerTimer = true;
|
1071 |
|
1072 |
|
1073 | var enableSchedulerTracing = true;
|
1074 |
|
1075 |
|
1076 | var enableSuspenseServerRenderer = false;
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 | var enableFlareAPI = false;
|
1103 |
|
1104 |
|
1105 | var enableFundamentalAPI = false;
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 | var warnAboutUnmockedScheduler = false;
|
1113 |
|
1114 | var revertPassiveEffectsChange = false;
|
1115 |
|
1116 |
|
1117 |
|
1118 | var flushSuspenseFallbacksInTests = true;
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 | var enableSuspenseCallback = false;
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 | var warnAboutDefaultPropsOnFunctionComponents = false;
|
1134 |
|
1135 | var disableLegacyContext = false;
|
1136 |
|
1137 | var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
1138 |
|
1139 | var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
1140 |
|
1141 | var describeComponentFrame = function (name, source, ownerName) {
|
1142 | var sourceInfo = '';
|
1143 | if (source) {
|
1144 | var path = source.fileName;
|
1145 | var fileName = path.replace(BEFORE_SLASH_RE, '');
|
1146 | {
|
1147 |
|
1148 |
|
1149 | if (/^index\./.test(fileName)) {
|
1150 | var match = path.match(BEFORE_SLASH_RE);
|
1151 | if (match) {
|
1152 | var pathBeforeSlash = match[1];
|
1153 | if (pathBeforeSlash) {
|
1154 | var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
1155 | fileName = folderName + '/' + fileName;
|
1156 | }
|
1157 | }
|
1158 | }
|
1159 | }
|
1160 | sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
1161 | } else if (ownerName) {
|
1162 | sourceInfo = ' (created by ' + ownerName + ')';
|
1163 | }
|
1164 | return '\n in ' + (name || 'Unknown') + sourceInfo;
|
1165 | };
|
1166 |
|
1167 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
1168 |
|
1169 | function describeFiber(fiber) {
|
1170 | switch (fiber.tag) {
|
1171 | case HostRoot:
|
1172 | case HostPortal:
|
1173 | case HostText:
|
1174 | case Fragment:
|
1175 | case ContextProvider:
|
1176 | case ContextConsumer:
|
1177 | return '';
|
1178 | default:
|
1179 | var owner = fiber._debugOwner;
|
1180 | var source = fiber._debugSource;
|
1181 | var name = getComponentName(fiber.type);
|
1182 | var ownerName = null;
|
1183 | if (owner) {
|
1184 | ownerName = getComponentName(owner.type);
|
1185 | }
|
1186 | return describeComponentFrame(name, source, ownerName);
|
1187 | }
|
1188 | }
|
1189 |
|
1190 | function getStackByFiberInDevAndProd(workInProgress) {
|
1191 | var info = '';
|
1192 | var node = workInProgress;
|
1193 | do {
|
1194 | info += describeFiber(node);
|
1195 | node = node.return;
|
1196 | } while (node);
|
1197 | return info;
|
1198 | }
|
1199 |
|
1200 | var current = null;
|
1201 | var phase = null;
|
1202 |
|
1203 | function getCurrentFiberOwnerNameInDevOrNull() {
|
1204 | {
|
1205 | if (current === null) {
|
1206 | return null;
|
1207 | }
|
1208 | var owner = current._debugOwner;
|
1209 | if (owner !== null && typeof owner !== 'undefined') {
|
1210 | return getComponentName(owner.type);
|
1211 | }
|
1212 | }
|
1213 | return null;
|
1214 | }
|
1215 |
|
1216 | function getCurrentFiberStackInDev() {
|
1217 | {
|
1218 | if (current === null) {
|
1219 | return '';
|
1220 | }
|
1221 |
|
1222 |
|
1223 | return getStackByFiberInDevAndProd(current);
|
1224 | }
|
1225 | return '';
|
1226 | }
|
1227 |
|
1228 | function resetCurrentFiber() {
|
1229 | {
|
1230 | ReactDebugCurrentFrame.getCurrentStack = null;
|
1231 | current = null;
|
1232 | phase = null;
|
1233 | }
|
1234 | }
|
1235 |
|
1236 | function setCurrentFiber(fiber) {
|
1237 | {
|
1238 | ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
|
1239 | current = fiber;
|
1240 | phase = null;
|
1241 | }
|
1242 | }
|
1243 |
|
1244 | function setCurrentPhase(lifeCyclePhase) {
|
1245 | {
|
1246 | phase = lifeCyclePhase;
|
1247 | }
|
1248 | }
|
1249 |
|
1250 |
|
1251 |
|
1252 | var reactEmoji = '\u269B';
|
1253 | var warningEmoji = '\u26D4';
|
1254 | var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
|
1255 |
|
1256 |
|
1257 |
|
1258 | var currentFiber = null;
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 | var currentPhase = null;
|
1264 | var currentPhaseFiber = null;
|
1265 |
|
1266 |
|
1267 |
|
1268 | var isCommitting = false;
|
1269 | var hasScheduledUpdateInCurrentCommit = false;
|
1270 | var hasScheduledUpdateInCurrentPhase = false;
|
1271 | var commitCountInCurrentWorkLoop = 0;
|
1272 | var effectCountInCurrentCommit = 0;
|
1273 | var isWaitingForCallback = false;
|
1274 |
|
1275 |
|
1276 | var labelsInCurrentCommit = new Set();
|
1277 |
|
1278 | var formatMarkName = function (markName) {
|
1279 | return reactEmoji + ' ' + markName;
|
1280 | };
|
1281 |
|
1282 | var formatLabel = function (label, warning) {
|
1283 | var prefix = warning ? warningEmoji + ' ' : reactEmoji + ' ';
|
1284 | var suffix = warning ? ' Warning: ' + warning : '';
|
1285 | return '' + prefix + label + suffix;
|
1286 | };
|
1287 |
|
1288 | var beginMark = function (markName) {
|
1289 | performance.mark(formatMarkName(markName));
|
1290 | };
|
1291 |
|
1292 | var clearMark = function (markName) {
|
1293 | performance.clearMarks(formatMarkName(markName));
|
1294 | };
|
1295 |
|
1296 | var endMark = function (label, markName, warning) {
|
1297 | var formattedMarkName = formatMarkName(markName);
|
1298 | var formattedLabel = formatLabel(label, warning);
|
1299 | try {
|
1300 | performance.measure(formattedLabel, formattedMarkName);
|
1301 | } catch (err) {}
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 | performance.clearMarks(formattedMarkName);
|
1308 | performance.clearMeasures(formattedLabel);
|
1309 | };
|
1310 |
|
1311 | var getFiberMarkName = function (label, debugID) {
|
1312 | return label + ' (#' + debugID + ')';
|
1313 | };
|
1314 |
|
1315 | var getFiberLabel = function (componentName, isMounted, phase) {
|
1316 | if (phase === null) {
|
1317 |
|
1318 | return componentName + ' [' + (isMounted ? 'update' : 'mount') + ']';
|
1319 | } else {
|
1320 |
|
1321 | return componentName + '.' + phase;
|
1322 | }
|
1323 | };
|
1324 |
|
1325 | var beginFiberMark = function (fiber, phase) {
|
1326 | var componentName = getComponentName(fiber.type) || 'Unknown';
|
1327 | var debugID = fiber._debugID;
|
1328 | var isMounted = fiber.alternate !== null;
|
1329 | var label = getFiberLabel(componentName, isMounted, phase);
|
1330 |
|
1331 | if (isCommitting && labelsInCurrentCommit.has(label)) {
|
1332 |
|
1333 |
|
1334 |
|
1335 | return false;
|
1336 | }
|
1337 | labelsInCurrentCommit.add(label);
|
1338 |
|
1339 | var markName = getFiberMarkName(label, debugID);
|
1340 | beginMark(markName);
|
1341 | return true;
|
1342 | };
|
1343 |
|
1344 | var clearFiberMark = function (fiber, phase) {
|
1345 | var componentName = getComponentName(fiber.type) || 'Unknown';
|
1346 | var debugID = fiber._debugID;
|
1347 | var isMounted = fiber.alternate !== null;
|
1348 | var label = getFiberLabel(componentName, isMounted, phase);
|
1349 | var markName = getFiberMarkName(label, debugID);
|
1350 | clearMark(markName);
|
1351 | };
|
1352 |
|
1353 | var endFiberMark = function (fiber, phase, warning) {
|
1354 | var componentName = getComponentName(fiber.type) || 'Unknown';
|
1355 | var debugID = fiber._debugID;
|
1356 | var isMounted = fiber.alternate !== null;
|
1357 | var label = getFiberLabel(componentName, isMounted, phase);
|
1358 | var markName = getFiberMarkName(label, debugID);
|
1359 | endMark(label, markName, warning);
|
1360 | };
|
1361 |
|
1362 | var shouldIgnoreFiber = function (fiber) {
|
1363 |
|
1364 |
|
1365 | switch (fiber.tag) {
|
1366 | case HostRoot:
|
1367 | case HostComponent:
|
1368 | case HostText:
|
1369 | case HostPortal:
|
1370 | case Fragment:
|
1371 | case ContextProvider:
|
1372 | case ContextConsumer:
|
1373 | case Mode$1:
|
1374 | return true;
|
1375 | default:
|
1376 | return false;
|
1377 | }
|
1378 | };
|
1379 |
|
1380 | var clearPendingPhaseMeasurement = function () {
|
1381 | if (currentPhase !== null && currentPhaseFiber !== null) {
|
1382 | clearFiberMark(currentPhaseFiber, currentPhase);
|
1383 | }
|
1384 | currentPhaseFiber = null;
|
1385 | currentPhase = null;
|
1386 | hasScheduledUpdateInCurrentPhase = false;
|
1387 | };
|
1388 |
|
1389 | var pauseTimers = function () {
|
1390 |
|
1391 |
|
1392 | var fiber = currentFiber;
|
1393 | while (fiber) {
|
1394 | if (fiber._debugIsCurrentlyTiming) {
|
1395 | endFiberMark(fiber, null, null);
|
1396 | }
|
1397 | fiber = fiber.return;
|
1398 | }
|
1399 | };
|
1400 |
|
1401 | var resumeTimersRecursively = function (fiber) {
|
1402 | if (fiber.return !== null) {
|
1403 | resumeTimersRecursively(fiber.return);
|
1404 | }
|
1405 | if (fiber._debugIsCurrentlyTiming) {
|
1406 | beginFiberMark(fiber, null);
|
1407 | }
|
1408 | };
|
1409 |
|
1410 | var resumeTimers = function () {
|
1411 |
|
1412 | if (currentFiber !== null) {
|
1413 | resumeTimersRecursively(currentFiber);
|
1414 | }
|
1415 | };
|
1416 |
|
1417 | function recordEffect() {
|
1418 | if (enableUserTimingAPI) {
|
1419 | effectCountInCurrentCommit++;
|
1420 | }
|
1421 | }
|
1422 |
|
1423 | function recordScheduleUpdate() {
|
1424 | if (enableUserTimingAPI) {
|
1425 | if (isCommitting) {
|
1426 | hasScheduledUpdateInCurrentCommit = true;
|
1427 | }
|
1428 | if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
|
1429 | hasScheduledUpdateInCurrentPhase = true;
|
1430 | }
|
1431 | }
|
1432 | }
|
1433 |
|
1434 | function startRequestCallbackTimer() {
|
1435 | if (enableUserTimingAPI) {
|
1436 | if (supportsUserTiming && !isWaitingForCallback) {
|
1437 | isWaitingForCallback = true;
|
1438 | beginMark('(Waiting for async callback...)');
|
1439 | }
|
1440 | }
|
1441 | }
|
1442 |
|
1443 | function stopRequestCallbackTimer(didExpire) {
|
1444 | if (enableUserTimingAPI) {
|
1445 | if (supportsUserTiming) {
|
1446 | isWaitingForCallback = false;
|
1447 | var warning = didExpire ? 'Update expired; will flush synchronously' : null;
|
1448 | endMark('(Waiting for async callback...)', '(Waiting for async callback...)', warning);
|
1449 | }
|
1450 | }
|
1451 | }
|
1452 |
|
1453 | function startWorkTimer(fiber) {
|
1454 | if (enableUserTimingAPI) {
|
1455 | if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
|
1456 | return;
|
1457 | }
|
1458 |
|
1459 | currentFiber = fiber;
|
1460 | if (!beginFiberMark(fiber, null)) {
|
1461 | return;
|
1462 | }
|
1463 | fiber._debugIsCurrentlyTiming = true;
|
1464 | }
|
1465 | }
|
1466 |
|
1467 | function cancelWorkTimer(fiber) {
|
1468 | if (enableUserTimingAPI) {
|
1469 | if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
|
1470 | return;
|
1471 | }
|
1472 |
|
1473 |
|
1474 | fiber._debugIsCurrentlyTiming = false;
|
1475 | clearFiberMark(fiber, null);
|
1476 | }
|
1477 | }
|
1478 |
|
1479 | function stopWorkTimer(fiber) {
|
1480 | if (enableUserTimingAPI) {
|
1481 | if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
|
1482 | return;
|
1483 | }
|
1484 |
|
1485 | currentFiber = fiber.return;
|
1486 | if (!fiber._debugIsCurrentlyTiming) {
|
1487 | return;
|
1488 | }
|
1489 | fiber._debugIsCurrentlyTiming = false;
|
1490 | endFiberMark(fiber, null, null);
|
1491 | }
|
1492 | }
|
1493 |
|
1494 | function stopFailedWorkTimer(fiber) {
|
1495 | if (enableUserTimingAPI) {
|
1496 | if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
|
1497 | return;
|
1498 | }
|
1499 |
|
1500 | currentFiber = fiber.return;
|
1501 | if (!fiber._debugIsCurrentlyTiming) {
|
1502 | return;
|
1503 | }
|
1504 | fiber._debugIsCurrentlyTiming = false;
|
1505 | var warning = fiber.tag === SuspenseComponent || fiber.tag === DehydratedSuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
|
1506 | endFiberMark(fiber, null, warning);
|
1507 | }
|
1508 | }
|
1509 |
|
1510 | function startPhaseTimer(fiber, phase) {
|
1511 | if (enableUserTimingAPI) {
|
1512 | if (!supportsUserTiming) {
|
1513 | return;
|
1514 | }
|
1515 | clearPendingPhaseMeasurement();
|
1516 | if (!beginFiberMark(fiber, phase)) {
|
1517 | return;
|
1518 | }
|
1519 | currentPhaseFiber = fiber;
|
1520 | currentPhase = phase;
|
1521 | }
|
1522 | }
|
1523 |
|
1524 | function stopPhaseTimer() {
|
1525 | if (enableUserTimingAPI) {
|
1526 | if (!supportsUserTiming) {
|
1527 | return;
|
1528 | }
|
1529 | if (currentPhase !== null && currentPhaseFiber !== null) {
|
1530 | var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
|
1531 | endFiberMark(currentPhaseFiber, currentPhase, warning);
|
1532 | }
|
1533 | currentPhase = null;
|
1534 | currentPhaseFiber = null;
|
1535 | }
|
1536 | }
|
1537 |
|
1538 | function startWorkLoopTimer(nextUnitOfWork) {
|
1539 | if (enableUserTimingAPI) {
|
1540 | currentFiber = nextUnitOfWork;
|
1541 | if (!supportsUserTiming) {
|
1542 | return;
|
1543 | }
|
1544 | commitCountInCurrentWorkLoop = 0;
|
1545 |
|
1546 |
|
1547 | beginMark('(React Tree Reconciliation)');
|
1548 |
|
1549 | resumeTimers();
|
1550 | }
|
1551 | }
|
1552 |
|
1553 | function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
|
1554 | if (enableUserTimingAPI) {
|
1555 | if (!supportsUserTiming) {
|
1556 | return;
|
1557 | }
|
1558 | var warning = null;
|
1559 | if (interruptedBy !== null) {
|
1560 | if (interruptedBy.tag === HostRoot) {
|
1561 | warning = 'A top-level update interrupted the previous render';
|
1562 | } else {
|
1563 | var componentName = getComponentName(interruptedBy.type) || 'Unknown';
|
1564 | warning = 'An update to ' + componentName + ' interrupted the previous render';
|
1565 | }
|
1566 | } else if (commitCountInCurrentWorkLoop > 1) {
|
1567 | warning = 'There were cascading updates';
|
1568 | }
|
1569 | commitCountInCurrentWorkLoop = 0;
|
1570 | var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)';
|
1571 |
|
1572 | pauseTimers();
|
1573 | endMark(label, '(React Tree Reconciliation)', warning);
|
1574 | }
|
1575 | }
|
1576 |
|
1577 | function startCommitTimer() {
|
1578 | if (enableUserTimingAPI) {
|
1579 | if (!supportsUserTiming) {
|
1580 | return;
|
1581 | }
|
1582 | isCommitting = true;
|
1583 | hasScheduledUpdateInCurrentCommit = false;
|
1584 | labelsInCurrentCommit.clear();
|
1585 | beginMark('(Committing Changes)');
|
1586 | }
|
1587 | }
|
1588 |
|
1589 | function stopCommitTimer() {
|
1590 | if (enableUserTimingAPI) {
|
1591 | if (!supportsUserTiming) {
|
1592 | return;
|
1593 | }
|
1594 |
|
1595 | var warning = null;
|
1596 | if (hasScheduledUpdateInCurrentCommit) {
|
1597 | warning = 'Lifecycle hook scheduled a cascading update';
|
1598 | } else if (commitCountInCurrentWorkLoop > 0) {
|
1599 | warning = 'Caused by a cascading update in earlier commit';
|
1600 | }
|
1601 | hasScheduledUpdateInCurrentCommit = false;
|
1602 | commitCountInCurrentWorkLoop++;
|
1603 | isCommitting = false;
|
1604 | labelsInCurrentCommit.clear();
|
1605 |
|
1606 | endMark('(Committing Changes)', '(Committing Changes)', warning);
|
1607 | }
|
1608 | }
|
1609 |
|
1610 | function startCommitSnapshotEffectsTimer() {
|
1611 | if (enableUserTimingAPI) {
|
1612 | if (!supportsUserTiming) {
|
1613 | return;
|
1614 | }
|
1615 | effectCountInCurrentCommit = 0;
|
1616 | beginMark('(Committing Snapshot Effects)');
|
1617 | }
|
1618 | }
|
1619 |
|
1620 | function stopCommitSnapshotEffectsTimer() {
|
1621 | if (enableUserTimingAPI) {
|
1622 | if (!supportsUserTiming) {
|
1623 | return;
|
1624 | }
|
1625 | var count = effectCountInCurrentCommit;
|
1626 | effectCountInCurrentCommit = 0;
|
1627 | endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null);
|
1628 | }
|
1629 | }
|
1630 |
|
1631 | function startCommitHostEffectsTimer() {
|
1632 | if (enableUserTimingAPI) {
|
1633 | if (!supportsUserTiming) {
|
1634 | return;
|
1635 | }
|
1636 | effectCountInCurrentCommit = 0;
|
1637 | beginMark('(Committing Host Effects)');
|
1638 | }
|
1639 | }
|
1640 |
|
1641 | function stopCommitHostEffectsTimer() {
|
1642 | if (enableUserTimingAPI) {
|
1643 | if (!supportsUserTiming) {
|
1644 | return;
|
1645 | }
|
1646 | var count = effectCountInCurrentCommit;
|
1647 | effectCountInCurrentCommit = 0;
|
1648 | endMark('(Committing Host Effects: ' + count + ' Total)', '(Committing Host Effects)', null);
|
1649 | }
|
1650 | }
|
1651 |
|
1652 | function startCommitLifeCyclesTimer() {
|
1653 | if (enableUserTimingAPI) {
|
1654 | if (!supportsUserTiming) {
|
1655 | return;
|
1656 | }
|
1657 | effectCountInCurrentCommit = 0;
|
1658 | beginMark('(Calling Lifecycle Methods)');
|
1659 | }
|
1660 | }
|
1661 |
|
1662 | function stopCommitLifeCyclesTimer() {
|
1663 | if (enableUserTimingAPI) {
|
1664 | if (!supportsUserTiming) {
|
1665 | return;
|
1666 | }
|
1667 | var count = effectCountInCurrentCommit;
|
1668 | effectCountInCurrentCommit = 0;
|
1669 | endMark('(Calling Lifecycle Methods: ' + count + ' Total)', '(Calling Lifecycle Methods)', null);
|
1670 | }
|
1671 | }
|
1672 |
|
1673 | var valueStack = [];
|
1674 |
|
1675 | var fiberStack = void 0;
|
1676 |
|
1677 | {
|
1678 | fiberStack = [];
|
1679 | }
|
1680 |
|
1681 | var index = -1;
|
1682 |
|
1683 | function createCursor(defaultValue) {
|
1684 | return {
|
1685 | current: defaultValue
|
1686 | };
|
1687 | }
|
1688 |
|
1689 | function pop(cursor, fiber) {
|
1690 | if (index < 0) {
|
1691 | {
|
1692 | warningWithoutStack$1(false, 'Unexpected pop.');
|
1693 | }
|
1694 | return;
|
1695 | }
|
1696 |
|
1697 | {
|
1698 | if (fiber !== fiberStack[index]) {
|
1699 | warningWithoutStack$1(false, 'Unexpected Fiber popped.');
|
1700 | }
|
1701 | }
|
1702 |
|
1703 | cursor.current = valueStack[index];
|
1704 |
|
1705 | valueStack[index] = null;
|
1706 |
|
1707 | {
|
1708 | fiberStack[index] = null;
|
1709 | }
|
1710 |
|
1711 | index--;
|
1712 | }
|
1713 |
|
1714 | function push(cursor, value, fiber) {
|
1715 | index++;
|
1716 |
|
1717 | valueStack[index] = cursor.current;
|
1718 |
|
1719 | {
|
1720 | fiberStack[index] = fiber;
|
1721 | }
|
1722 |
|
1723 | cursor.current = value;
|
1724 | }
|
1725 |
|
1726 | var warnedAboutMissingGetChildContext = void 0;
|
1727 |
|
1728 | {
|
1729 | warnedAboutMissingGetChildContext = {};
|
1730 | }
|
1731 |
|
1732 | var emptyContextObject = {};
|
1733 | {
|
1734 | Object.freeze(emptyContextObject);
|
1735 | }
|
1736 |
|
1737 |
|
1738 | var contextStackCursor = createCursor(emptyContextObject);
|
1739 |
|
1740 | var didPerformWorkStackCursor = createCursor(false);
|
1741 |
|
1742 |
|
1743 |
|
1744 | var previousContext = emptyContextObject;
|
1745 |
|
1746 | function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
|
1747 | if (disableLegacyContext) {
|
1748 | return emptyContextObject;
|
1749 | } else {
|
1750 | if (didPushOwnContextIfProvider && isContextProvider(Component)) {
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 | return previousContext;
|
1756 | }
|
1757 | return contextStackCursor.current;
|
1758 | }
|
1759 | }
|
1760 |
|
1761 | function cacheContext(workInProgress, unmaskedContext, maskedContext) {
|
1762 | if (disableLegacyContext) {
|
1763 | return;
|
1764 | } else {
|
1765 | var instance = workInProgress.stateNode;
|
1766 | instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
|
1767 | instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
|
1768 | }
|
1769 | }
|
1770 |
|
1771 | function getMaskedContext(workInProgress, unmaskedContext) {
|
1772 | if (disableLegacyContext) {
|
1773 | return emptyContextObject;
|
1774 | } else {
|
1775 | var type = workInProgress.type;
|
1776 | var contextTypes = type.contextTypes;
|
1777 | if (!contextTypes) {
|
1778 | return emptyContextObject;
|
1779 | }
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 | var instance = workInProgress.stateNode;
|
1785 | if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
|
1786 | return instance.__reactInternalMemoizedMaskedChildContext;
|
1787 | }
|
1788 |
|
1789 | var context = {};
|
1790 | for (var key in contextTypes) {
|
1791 | context[key] = unmaskedContext[key];
|
1792 | }
|
1793 |
|
1794 | {
|
1795 | var name = getComponentName(type) || 'Unknown';
|
1796 | checkPropTypes(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
|
1797 | }
|
1798 |
|
1799 |
|
1800 |
|
1801 | if (instance) {
|
1802 | cacheContext(workInProgress, unmaskedContext, context);
|
1803 | }
|
1804 |
|
1805 | return context;
|
1806 | }
|
1807 | }
|
1808 |
|
1809 | function hasContextChanged() {
|
1810 | if (disableLegacyContext) {
|
1811 | return false;
|
1812 | } else {
|
1813 | return didPerformWorkStackCursor.current;
|
1814 | }
|
1815 | }
|
1816 |
|
1817 | function isContextProvider(type) {
|
1818 | if (disableLegacyContext) {
|
1819 | return false;
|
1820 | } else {
|
1821 | var childContextTypes = type.childContextTypes;
|
1822 | return childContextTypes !== null && childContextTypes !== undefined;
|
1823 | }
|
1824 | }
|
1825 |
|
1826 | function popContext(fiber) {
|
1827 | if (disableLegacyContext) {
|
1828 | return;
|
1829 | } else {
|
1830 | pop(didPerformWorkStackCursor, fiber);
|
1831 | pop(contextStackCursor, fiber);
|
1832 | }
|
1833 | }
|
1834 |
|
1835 | function popTopLevelContextObject(fiber) {
|
1836 | if (disableLegacyContext) {
|
1837 | return;
|
1838 | } else {
|
1839 | pop(didPerformWorkStackCursor, fiber);
|
1840 | pop(contextStackCursor, fiber);
|
1841 | }
|
1842 | }
|
1843 |
|
1844 | function pushTopLevelContextObject(fiber, context, didChange) {
|
1845 | if (disableLegacyContext) {
|
1846 | return;
|
1847 | } else {
|
1848 | (function () {
|
1849 | if (!(contextStackCursor.current === emptyContextObject)) {
|
1850 | {
|
1851 | throw ReactError(Error('Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.'));
|
1852 | }
|
1853 | }
|
1854 | })();
|
1855 |
|
1856 | push(contextStackCursor, context, fiber);
|
1857 | push(didPerformWorkStackCursor, didChange, fiber);
|
1858 | }
|
1859 | }
|
1860 |
|
1861 | function processChildContext(fiber, type, parentContext) {
|
1862 | if (disableLegacyContext) {
|
1863 | return parentContext;
|
1864 | } else {
|
1865 | var instance = fiber.stateNode;
|
1866 | var childContextTypes = type.childContextTypes;
|
1867 |
|
1868 |
|
1869 |
|
1870 | if (typeof instance.getChildContext !== 'function') {
|
1871 | {
|
1872 | var componentName = getComponentName(type) || 'Unknown';
|
1873 |
|
1874 | if (!warnedAboutMissingGetChildContext[componentName]) {
|
1875 | warnedAboutMissingGetChildContext[componentName] = true;
|
1876 | warningWithoutStack$1(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
|
1877 | }
|
1878 | }
|
1879 | return parentContext;
|
1880 | }
|
1881 |
|
1882 | var childContext = void 0;
|
1883 | {
|
1884 | setCurrentPhase('getChildContext');
|
1885 | }
|
1886 | startPhaseTimer(fiber, 'getChildContext');
|
1887 | childContext = instance.getChildContext();
|
1888 | stopPhaseTimer();
|
1889 | {
|
1890 | setCurrentPhase(null);
|
1891 | }
|
1892 | for (var contextKey in childContext) {
|
1893 | (function () {
|
1894 | if (!(contextKey in childContextTypes)) {
|
1895 | {
|
1896 | throw ReactError(Error((getComponentName(type) || 'Unknown') + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.'));
|
1897 | }
|
1898 | }
|
1899 | })();
|
1900 | }
|
1901 | {
|
1902 | var name = getComponentName(type) || 'Unknown';
|
1903 | checkPropTypes(childContextTypes, childContext, 'child context', name,
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 | getCurrentFiberStackInDev);
|
1910 | }
|
1911 |
|
1912 | return _assign({}, parentContext, childContext);
|
1913 | }
|
1914 | }
|
1915 |
|
1916 | function pushContextProvider(workInProgress) {
|
1917 | if (disableLegacyContext) {
|
1918 | return false;
|
1919 | } else {
|
1920 | var instance = workInProgress.stateNode;
|
1921 |
|
1922 |
|
1923 |
|
1924 | var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
|
1925 |
|
1926 |
|
1927 |
|
1928 | previousContext = contextStackCursor.current;
|
1929 | push(contextStackCursor, memoizedMergedChildContext, workInProgress);
|
1930 | push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
|
1931 |
|
1932 | return true;
|
1933 | }
|
1934 | }
|
1935 |
|
1936 | function invalidateContextProvider(workInProgress, type, didChange) {
|
1937 | if (disableLegacyContext) {
|
1938 | return;
|
1939 | } else {
|
1940 | var instance = workInProgress.stateNode;
|
1941 | (function () {
|
1942 | if (!instance) {
|
1943 | {
|
1944 | throw ReactError(Error('Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.'));
|
1945 | }
|
1946 | }
|
1947 | })();
|
1948 |
|
1949 | if (didChange) {
|
1950 |
|
1951 |
|
1952 |
|
1953 | var mergedContext = processChildContext(workInProgress, type, previousContext);
|
1954 | instance.__reactInternalMemoizedMergedChildContext = mergedContext;
|
1955 |
|
1956 |
|
1957 |
|
1958 | pop(didPerformWorkStackCursor, workInProgress);
|
1959 | pop(contextStackCursor, workInProgress);
|
1960 |
|
1961 | push(contextStackCursor, mergedContext, workInProgress);
|
1962 | push(didPerformWorkStackCursor, didChange, workInProgress);
|
1963 | } else {
|
1964 | pop(didPerformWorkStackCursor, workInProgress);
|
1965 | push(didPerformWorkStackCursor, didChange, workInProgress);
|
1966 | }
|
1967 | }
|
1968 | }
|
1969 |
|
1970 | function findCurrentUnmaskedContext(fiber) {
|
1971 | if (disableLegacyContext) {
|
1972 | return emptyContextObject;
|
1973 | } else {
|
1974 |
|
1975 |
|
1976 | (function () {
|
1977 | if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
|
1978 | {
|
1979 | throw ReactError(Error('Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.'));
|
1980 | }
|
1981 | }
|
1982 | })();
|
1983 |
|
1984 | var node = fiber;
|
1985 | do {
|
1986 | switch (node.tag) {
|
1987 | case HostRoot:
|
1988 | return node.stateNode.context;
|
1989 | case ClassComponent:
|
1990 | {
|
1991 | var Component = node.type;
|
1992 | if (isContextProvider(Component)) {
|
1993 | return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
1994 | }
|
1995 | break;
|
1996 | }
|
1997 | }
|
1998 | node = node.return;
|
1999 | } while (node !== null);
|
2000 | (function () {
|
2001 | {
|
2002 | {
|
2003 | throw ReactError(Error('Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.'));
|
2004 | }
|
2005 | }
|
2006 | })();
|
2007 | }
|
2008 | }
|
2009 |
|
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 | var warning = warningWithoutStack$1;
|
2018 |
|
2019 | {
|
2020 | warning = function (condition, format) {
|
2021 | if (condition) {
|
2022 | return;
|
2023 | }
|
2024 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
2025 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
2026 |
|
2027 |
|
2028 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
2029 | args[_key - 2] = arguments[_key];
|
2030 | }
|
2031 |
|
2032 | warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
2033 | };
|
2034 | }
|
2035 |
|
2036 | var warning$1 = warning;
|
2037 |
|
2038 |
|
2039 |
|
2040 | var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority;
|
2041 | var Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback;
|
2042 | var Scheduler_cancelCallback = Scheduler.unstable_cancelCallback;
|
2043 | var Scheduler_shouldYield = Scheduler.unstable_shouldYield;
|
2044 | var Scheduler_requestPaint = Scheduler.unstable_requestPaint;
|
2045 | var Scheduler_now = Scheduler.unstable_now;
|
2046 | var Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel;
|
2047 | var Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority;
|
2048 | var Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority;
|
2049 | var Scheduler_NormalPriority = Scheduler.unstable_NormalPriority;
|
2050 | var Scheduler_LowPriority = Scheduler.unstable_LowPriority;
|
2051 | var Scheduler_IdlePriority = Scheduler.unstable_IdlePriority;
|
2052 |
|
2053 |
|
2054 | if (enableSchedulerTracing) {
|
2055 |
|
2056 |
|
2057 |
|
2058 | (function () {
|
2059 | if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) {
|
2060 | {
|
2061 | throw ReactError(Error('It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling'));
|
2062 | }
|
2063 | }
|
2064 | })();
|
2065 | }
|
2066 |
|
2067 | var fakeCallbackNode = {};
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 | var ImmediatePriority = 99;
|
2073 | var UserBlockingPriority = 98;
|
2074 | var NormalPriority = 97;
|
2075 | var LowPriority = 96;
|
2076 | var IdlePriority = 95;
|
2077 |
|
2078 | var NoPriority = 90;
|
2079 |
|
2080 | var shouldYield = Scheduler_shouldYield;
|
2081 | var requestPaint =
|
2082 |
|
2083 | Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {};
|
2084 |
|
2085 | var syncQueue = null;
|
2086 | var immediateQueueCallbackNode = null;
|
2087 | var isFlushingSyncQueue = false;
|
2088 | var initialTimeMs = Scheduler_now();
|
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 | var now = initialTimeMs < 10000 ? Scheduler_now : function () {
|
2098 | return Scheduler_now() - initialTimeMs;
|
2099 | };
|
2100 |
|
2101 | function getCurrentPriorityLevel() {
|
2102 | switch (Scheduler_getCurrentPriorityLevel()) {
|
2103 | case Scheduler_ImmediatePriority:
|
2104 | return ImmediatePriority;
|
2105 | case Scheduler_UserBlockingPriority:
|
2106 | return UserBlockingPriority;
|
2107 | case Scheduler_NormalPriority:
|
2108 | return NormalPriority;
|
2109 | case Scheduler_LowPriority:
|
2110 | return LowPriority;
|
2111 | case Scheduler_IdlePriority:
|
2112 | return IdlePriority;
|
2113 | default:
|
2114 | (function () {
|
2115 | {
|
2116 | {
|
2117 | throw ReactError(Error('Unknown priority level.'));
|
2118 | }
|
2119 | }
|
2120 | })();
|
2121 | }
|
2122 | }
|
2123 |
|
2124 | function reactPriorityToSchedulerPriority(reactPriorityLevel) {
|
2125 | switch (reactPriorityLevel) {
|
2126 | case ImmediatePriority:
|
2127 | return Scheduler_ImmediatePriority;
|
2128 | case UserBlockingPriority:
|
2129 | return Scheduler_UserBlockingPriority;
|
2130 | case NormalPriority:
|
2131 | return Scheduler_NormalPriority;
|
2132 | case LowPriority:
|
2133 | return Scheduler_LowPriority;
|
2134 | case IdlePriority:
|
2135 | return Scheduler_IdlePriority;
|
2136 | default:
|
2137 | (function () {
|
2138 | {
|
2139 | {
|
2140 | throw ReactError(Error('Unknown priority level.'));
|
2141 | }
|
2142 | }
|
2143 | })();
|
2144 | }
|
2145 | }
|
2146 |
|
2147 | function runWithPriority(reactPriorityLevel, fn) {
|
2148 | var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
|
2149 | return Scheduler_runWithPriority(priorityLevel, fn);
|
2150 | }
|
2151 |
|
2152 | function scheduleCallback(reactPriorityLevel, callback, options) {
|
2153 | var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
|
2154 | return Scheduler_scheduleCallback(priorityLevel, callback, options);
|
2155 | }
|
2156 |
|
2157 | function scheduleSyncCallback(callback) {
|
2158 |
|
2159 |
|
2160 | if (syncQueue === null) {
|
2161 | syncQueue = [callback];
|
2162 |
|
2163 | immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl);
|
2164 | } else {
|
2165 |
|
2166 |
|
2167 | syncQueue.push(callback);
|
2168 | }
|
2169 | return fakeCallbackNode;
|
2170 | }
|
2171 |
|
2172 | function cancelCallback(callbackNode) {
|
2173 | if (callbackNode !== fakeCallbackNode) {
|
2174 | Scheduler_cancelCallback(callbackNode);
|
2175 | }
|
2176 | }
|
2177 |
|
2178 | function flushSyncCallbackQueue() {
|
2179 | if (immediateQueueCallbackNode !== null) {
|
2180 | Scheduler_cancelCallback(immediateQueueCallbackNode);
|
2181 | }
|
2182 | flushSyncCallbackQueueImpl();
|
2183 | }
|
2184 |
|
2185 | function flushSyncCallbackQueueImpl() {
|
2186 | if (!isFlushingSyncQueue && syncQueue !== null) {
|
2187 |
|
2188 | isFlushingSyncQueue = true;
|
2189 | var i = 0;
|
2190 | try {
|
2191 | var _isSync = true;
|
2192 | var queue = syncQueue;
|
2193 | runWithPriority(ImmediatePriority, function () {
|
2194 | for (; i < queue.length; i++) {
|
2195 | var callback = queue[i];
|
2196 | do {
|
2197 | callback = callback(_isSync);
|
2198 | } while (callback !== null);
|
2199 | }
|
2200 | });
|
2201 | syncQueue = null;
|
2202 | } catch (error) {
|
2203 |
|
2204 | if (syncQueue !== null) {
|
2205 | syncQueue = syncQueue.slice(i + 1);
|
2206 | }
|
2207 |
|
2208 | Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue);
|
2209 | throw error;
|
2210 | } finally {
|
2211 | isFlushingSyncQueue = false;
|
2212 | }
|
2213 | }
|
2214 | }
|
2215 |
|
2216 | var NoMode = 0;
|
2217 | var StrictMode = 1;
|
2218 |
|
2219 |
|
2220 | var BatchedMode = 2;
|
2221 | var ConcurrentMode = 4;
|
2222 | var ProfileMode = 8;
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 | var MAX_SIGNED_31_BIT_INT = 1073741823;
|
2228 |
|
2229 | var NoWork = 0;
|
2230 | var Never = 1;
|
2231 | var Sync = MAX_SIGNED_31_BIT_INT;
|
2232 | var Batched = Sync - 1;
|
2233 |
|
2234 | var UNIT_SIZE = 10;
|
2235 | var MAGIC_NUMBER_OFFSET = Batched - 1;
|
2236 |
|
2237 |
|
2238 | function msToExpirationTime(ms) {
|
2239 |
|
2240 | return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
|
2241 | }
|
2242 |
|
2243 | function expirationTimeToMs(expirationTime) {
|
2244 | return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE;
|
2245 | }
|
2246 |
|
2247 | function ceiling(num, precision) {
|
2248 | return ((num / precision | 0) + 1) * precision;
|
2249 | }
|
2250 |
|
2251 | function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
|
2252 | return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
|
2253 | }
|
2254 |
|
2255 |
|
2256 |
|
2257 | var LOW_PRIORITY_EXPIRATION = 5000;
|
2258 | var LOW_PRIORITY_BATCH_SIZE = 250;
|
2259 |
|
2260 | function computeAsyncExpiration(currentTime) {
|
2261 | return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
|
2262 | }
|
2263 |
|
2264 | function computeSuspenseExpiration(currentTime, timeoutMs) {
|
2265 |
|
2266 | return computeExpirationBucket(currentTime, timeoutMs, LOW_PRIORITY_BATCH_SIZE);
|
2267 | }
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 | var HIGH_PRIORITY_EXPIRATION = 500;
|
2281 | var HIGH_PRIORITY_BATCH_SIZE = 100;
|
2282 |
|
2283 | function computeInteractiveExpiration(currentTime) {
|
2284 | return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
|
2285 | }
|
2286 |
|
2287 | function inferPriorityFromExpirationTime(currentTime, expirationTime) {
|
2288 | if (expirationTime === Sync) {
|
2289 | return ImmediatePriority;
|
2290 | }
|
2291 | if (expirationTime === Never) {
|
2292 | return IdlePriority;
|
2293 | }
|
2294 | var msUntil = expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime);
|
2295 | if (msUntil <= 0) {
|
2296 | return ImmediatePriority;
|
2297 | }
|
2298 | if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) {
|
2299 | return UserBlockingPriority;
|
2300 | }
|
2301 | if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) {
|
2302 | return NormalPriority;
|
2303 | }
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 | return IdlePriority;
|
2309 | }
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 | function is(x, y) {
|
2316 | return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y
|
2317 | ;
|
2318 | }
|
2319 |
|
2320 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 | function shallowEqual(objA, objB) {
|
2328 | if (is(objA, objB)) {
|
2329 | return true;
|
2330 | }
|
2331 |
|
2332 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
2333 | return false;
|
2334 | }
|
2335 |
|
2336 | var keysA = Object.keys(objA);
|
2337 | var keysB = Object.keys(objB);
|
2338 |
|
2339 | if (keysA.length !== keysB.length) {
|
2340 | return false;
|
2341 | }
|
2342 |
|
2343 |
|
2344 | for (var i = 0; i < keysA.length; i++) {
|
2345 | if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
2346 | return false;
|
2347 | }
|
2348 | }
|
2349 |
|
2350 | return true;
|
2351 | }
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 | var lowPriorityWarning = function () {};
|
2368 |
|
2369 | {
|
2370 | var printWarning = function (format) {
|
2371 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
2372 | args[_key - 1] = arguments[_key];
|
2373 | }
|
2374 |
|
2375 | var argIndex = 0;
|
2376 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
2377 | return args[argIndex++];
|
2378 | });
|
2379 | if (typeof console !== 'undefined') {
|
2380 | console.warn(message);
|
2381 | }
|
2382 | try {
|
2383 |
|
2384 |
|
2385 |
|
2386 | throw new Error(message);
|
2387 | } catch (x) {}
|
2388 | };
|
2389 |
|
2390 | lowPriorityWarning = function (condition, format) {
|
2391 | if (format === undefined) {
|
2392 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
2393 | }
|
2394 | if (!condition) {
|
2395 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
2396 | args[_key2 - 2] = arguments[_key2];
|
2397 | }
|
2398 |
|
2399 | printWarning.apply(undefined, [format].concat(args));
|
2400 | }
|
2401 | };
|
2402 | }
|
2403 |
|
2404 | var lowPriorityWarning$1 = lowPriorityWarning;
|
2405 |
|
2406 | var ReactStrictModeWarnings = {
|
2407 | recordUnsafeLifecycleWarnings: function (fiber, instance) {},
|
2408 | flushPendingUnsafeLifecycleWarnings: function () {},
|
2409 | recordLegacyContextWarning: function (fiber, instance) {},
|
2410 | flushLegacyContextWarning: function () {},
|
2411 | discardPendingWarnings: function () {}
|
2412 | };
|
2413 |
|
2414 | {
|
2415 | var findStrictRoot = function (fiber) {
|
2416 | var maybeStrictRoot = null;
|
2417 |
|
2418 | var node = fiber;
|
2419 | while (node !== null) {
|
2420 | if (node.mode & StrictMode) {
|
2421 | maybeStrictRoot = node;
|
2422 | }
|
2423 | node = node.return;
|
2424 | }
|
2425 |
|
2426 | return maybeStrictRoot;
|
2427 | };
|
2428 |
|
2429 | var setToSortedString = function (set) {
|
2430 | var array = [];
|
2431 | set.forEach(function (value) {
|
2432 | array.push(value);
|
2433 | });
|
2434 | return array.sort().join(', ');
|
2435 | };
|
2436 |
|
2437 | var pendingComponentWillMountWarnings = [];
|
2438 | var pendingUNSAFE_ComponentWillMountWarnings = [];
|
2439 | var pendingComponentWillReceivePropsWarnings = [];
|
2440 | var pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
2441 | var pendingComponentWillUpdateWarnings = [];
|
2442 | var pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
2443 |
|
2444 |
|
2445 | var didWarnAboutUnsafeLifecycles = new Set();
|
2446 |
|
2447 | ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
|
2448 |
|
2449 | if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
|
2450 | return;
|
2451 | }
|
2452 |
|
2453 | if (typeof instance.componentWillMount === 'function' &&
|
2454 |
|
2455 | instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
2456 | pendingComponentWillMountWarnings.push(fiber);
|
2457 | }
|
2458 |
|
2459 | if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') {
|
2460 | pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
|
2461 | }
|
2462 |
|
2463 | if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
2464 | pendingComponentWillReceivePropsWarnings.push(fiber);
|
2465 | }
|
2466 |
|
2467 | if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
2468 | pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
|
2469 | }
|
2470 |
|
2471 | if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
2472 | pendingComponentWillUpdateWarnings.push(fiber);
|
2473 | }
|
2474 |
|
2475 | if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
2476 | pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
|
2477 | }
|
2478 | };
|
2479 |
|
2480 | ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
|
2481 |
|
2482 | var componentWillMountUniqueNames = new Set();
|
2483 | if (pendingComponentWillMountWarnings.length > 0) {
|
2484 | pendingComponentWillMountWarnings.forEach(function (fiber) {
|
2485 | componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
2486 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
2487 | });
|
2488 | pendingComponentWillMountWarnings = [];
|
2489 | }
|
2490 |
|
2491 | var UNSAFE_componentWillMountUniqueNames = new Set();
|
2492 | if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
|
2493 | pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) {
|
2494 | UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
2495 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
2496 | });
|
2497 | pendingUNSAFE_ComponentWillMountWarnings = [];
|
2498 | }
|
2499 |
|
2500 | var componentWillReceivePropsUniqueNames = new Set();
|
2501 | if (pendingComponentWillReceivePropsWarnings.length > 0) {
|
2502 | pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
|
2503 | componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
2504 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
2505 | });
|
2506 |
|
2507 | pendingComponentWillReceivePropsWarnings = [];
|
2508 | }
|
2509 |
|
2510 | var UNSAFE_componentWillReceivePropsUniqueNames = new Set();
|
2511 | if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
|
2512 | pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) {
|
2513 | UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
2514 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
2515 | });
|
2516 |
|
2517 | pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
2518 | }
|
2519 |
|
2520 | var componentWillUpdateUniqueNames = new Set();
|
2521 | if (pendingComponentWillUpdateWarnings.length > 0) {
|
2522 | pendingComponentWillUpdateWarnings.forEach(function (fiber) {
|
2523 | componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
2524 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
2525 | });
|
2526 |
|
2527 | pendingComponentWillUpdateWarnings = [];
|
2528 | }
|
2529 |
|
2530 | var UNSAFE_componentWillUpdateUniqueNames = new Set();
|
2531 | if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
|
2532 | pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) {
|
2533 | UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
|
2534 | didWarnAboutUnsafeLifecycles.add(fiber.type);
|
2535 | });
|
2536 |
|
2537 | pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
2538 | }
|
2539 |
|
2540 |
|
2541 |
|
2542 | if (UNSAFE_componentWillMountUniqueNames.size > 0) {
|
2543 | var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames);
|
2544 | warningWithoutStack$1(false, 'Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames);
|
2545 | }
|
2546 |
|
2547 | if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) {
|
2548 | var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames);
|
2549 | warningWithoutStack$1(false, 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '\nPlease update the following components: %s', _sortedNames);
|
2550 | }
|
2551 |
|
2552 | if (UNSAFE_componentWillUpdateUniqueNames.size > 0) {
|
2553 | var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames);
|
2554 | warningWithoutStack$1(false, 'Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2);
|
2555 | }
|
2556 |
|
2557 | if (componentWillMountUniqueNames.size > 0) {
|
2558 | var _sortedNames3 = setToSortedString(componentWillMountUniqueNames);
|
2559 |
|
2560 | lowPriorityWarning$1(false, 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3);
|
2561 | }
|
2562 |
|
2563 | if (componentWillReceivePropsUniqueNames.size > 0) {
|
2564 | var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames);
|
2565 |
|
2566 | lowPriorityWarning$1(false, 'componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4);
|
2567 | }
|
2568 |
|
2569 | if (componentWillUpdateUniqueNames.size > 0) {
|
2570 | var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames);
|
2571 |
|
2572 | lowPriorityWarning$1(false, 'componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5);
|
2573 | }
|
2574 | };
|
2575 |
|
2576 | var pendingLegacyContextWarning = new Map();
|
2577 |
|
2578 |
|
2579 | var didWarnAboutLegacyContext = new Set();
|
2580 |
|
2581 | ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
|
2582 | var strictRoot = findStrictRoot(fiber);
|
2583 | if (strictRoot === null) {
|
2584 | warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
|
2585 | return;
|
2586 | }
|
2587 |
|
2588 |
|
2589 | if (didWarnAboutLegacyContext.has(fiber.type)) {
|
2590 | return;
|
2591 | }
|
2592 |
|
2593 | var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
|
2594 |
|
2595 | if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') {
|
2596 | if (warningsForRoot === undefined) {
|
2597 | warningsForRoot = [];
|
2598 | pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
|
2599 | }
|
2600 | warningsForRoot.push(fiber);
|
2601 | }
|
2602 | };
|
2603 |
|
2604 | ReactStrictModeWarnings.flushLegacyContextWarning = function () {
|
2605 | pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) {
|
2606 | var uniqueNames = new Set();
|
2607 | fiberArray.forEach(function (fiber) {
|
2608 | uniqueNames.add(getComponentName(fiber.type) || 'Component');
|
2609 | didWarnAboutLegacyContext.add(fiber.type);
|
2610 | });
|
2611 |
|
2612 | var sortedNames = setToSortedString(uniqueNames);
|
2613 | var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
|
2614 |
|
2615 | warningWithoutStack$1(false, 'Legacy context API has been detected within a strict-mode tree: %s' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-legacy-context', strictRootComponentStack, sortedNames);
|
2616 | });
|
2617 | };
|
2618 |
|
2619 | ReactStrictModeWarnings.discardPendingWarnings = function () {
|
2620 | pendingComponentWillMountWarnings = [];
|
2621 | pendingUNSAFE_ComponentWillMountWarnings = [];
|
2622 | pendingComponentWillReceivePropsWarnings = [];
|
2623 | pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
2624 | pendingComponentWillUpdateWarnings = [];
|
2625 | pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
2626 | pendingLegacyContextWarning = new Map();
|
2627 | };
|
2628 | }
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 | var resolveFamily = null;
|
2637 |
|
2638 | var failedBoundaries = null;
|
2639 |
|
2640 | var setRefreshHandler = function (handler) {
|
2641 | {
|
2642 | resolveFamily = handler;
|
2643 | }
|
2644 | };
|
2645 |
|
2646 | function resolveFunctionForHotReloading(type) {
|
2647 | {
|
2648 | if (resolveFamily === null) {
|
2649 |
|
2650 | return type;
|
2651 | }
|
2652 | var family = resolveFamily(type);
|
2653 | if (family === undefined) {
|
2654 | return type;
|
2655 | }
|
2656 |
|
2657 | return family.current;
|
2658 | }
|
2659 | }
|
2660 |
|
2661 | function resolveClassForHotReloading(type) {
|
2662 |
|
2663 | return resolveFunctionForHotReloading(type);
|
2664 | }
|
2665 |
|
2666 | function resolveForwardRefForHotReloading(type) {
|
2667 | {
|
2668 | if (resolveFamily === null) {
|
2669 |
|
2670 | return type;
|
2671 | }
|
2672 | var family = resolveFamily(type);
|
2673 | if (family === undefined) {
|
2674 |
|
2675 | if (type !== null && type !== undefined && typeof type.render === 'function') {
|
2676 |
|
2677 |
|
2678 |
|
2679 | var currentRender = resolveFunctionForHotReloading(type.render);
|
2680 | if (type.render !== currentRender) {
|
2681 | var syntheticType = {
|
2682 | $$typeof: REACT_FORWARD_REF_TYPE,
|
2683 | render: currentRender
|
2684 | };
|
2685 | if (type.displayName !== undefined) {
|
2686 | syntheticType.displayName = type.displayName;
|
2687 | }
|
2688 | return syntheticType;
|
2689 | }
|
2690 | }
|
2691 | return type;
|
2692 | }
|
2693 |
|
2694 | return family.current;
|
2695 | }
|
2696 | }
|
2697 |
|
2698 | function isCompatibleFamilyForHotReloading(fiber, element) {
|
2699 | {
|
2700 | if (resolveFamily === null) {
|
2701 |
|
2702 | return false;
|
2703 | }
|
2704 |
|
2705 | var prevType = fiber.elementType;
|
2706 | var nextType = element.type;
|
2707 |
|
2708 |
|
2709 | var needsCompareFamilies = false;
|
2710 |
|
2711 | var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null;
|
2712 |
|
2713 | switch (fiber.tag) {
|
2714 | case ClassComponent:
|
2715 | {
|
2716 | if (typeof nextType === 'function') {
|
2717 | needsCompareFamilies = true;
|
2718 | }
|
2719 | break;
|
2720 | }
|
2721 | case FunctionComponent:
|
2722 | {
|
2723 | if (typeof nextType === 'function') {
|
2724 | needsCompareFamilies = true;
|
2725 | } else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 | needsCompareFamilies = true;
|
2731 | }
|
2732 | break;
|
2733 | }
|
2734 | case ForwardRef:
|
2735 | {
|
2736 | if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
|
2737 | needsCompareFamilies = true;
|
2738 | } else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
2739 | needsCompareFamilies = true;
|
2740 | }
|
2741 | break;
|
2742 | }
|
2743 | case MemoComponent:
|
2744 | case SimpleMemoComponent:
|
2745 | {
|
2746 | if ($$typeofNextType === REACT_MEMO_TYPE) {
|
2747 |
|
2748 |
|
2749 | needsCompareFamilies = true;
|
2750 | } else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
2751 | needsCompareFamilies = true;
|
2752 | }
|
2753 | break;
|
2754 | }
|
2755 | default:
|
2756 | return false;
|
2757 | }
|
2758 |
|
2759 |
|
2760 | if (needsCompareFamilies) {
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 | var prevFamily = resolveFamily(prevType);
|
2767 | if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
|
2768 | return true;
|
2769 | }
|
2770 | }
|
2771 | return false;
|
2772 | }
|
2773 | }
|
2774 |
|
2775 | function markFailedErrorBoundaryForHotReloading(fiber) {
|
2776 | {
|
2777 | if (resolveFamily === null) {
|
2778 |
|
2779 | return;
|
2780 | }
|
2781 | if (typeof WeakSet !== 'function') {
|
2782 | return;
|
2783 | }
|
2784 | if (failedBoundaries === null) {
|
2785 | failedBoundaries = new WeakSet();
|
2786 | }
|
2787 | failedBoundaries.add(fiber);
|
2788 | }
|
2789 | }
|
2790 |
|
2791 | var scheduleRefresh = function (root, update) {
|
2792 | {
|
2793 | if (resolveFamily === null) {
|
2794 |
|
2795 | return;
|
2796 | }
|
2797 | var _staleFamilies = update.staleFamilies,
|
2798 | _updatedFamilies = update.updatedFamilies;
|
2799 |
|
2800 | flushPassiveEffects();
|
2801 | flushSync(function () {
|
2802 | scheduleFibersWithFamiliesRecursively(root.current, _updatedFamilies, _staleFamilies);
|
2803 | });
|
2804 | }
|
2805 | };
|
2806 |
|
2807 | var scheduleRoot = function (root, element) {
|
2808 | {
|
2809 | if (root.context !== emptyContextObject) {
|
2810 |
|
2811 |
|
2812 |
|
2813 | return;
|
2814 | }
|
2815 | flushPassiveEffects();
|
2816 | updateContainerAtExpirationTime(element, root, null, Sync, null);
|
2817 | }
|
2818 | };
|
2819 |
|
2820 | function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
|
2821 | {
|
2822 | var alternate = fiber.alternate,
|
2823 | child = fiber.child,
|
2824 | sibling = fiber.sibling,
|
2825 | tag = fiber.tag,
|
2826 | type = fiber.type;
|
2827 |
|
2828 |
|
2829 | var candidateType = null;
|
2830 | switch (tag) {
|
2831 | case FunctionComponent:
|
2832 | case SimpleMemoComponent:
|
2833 | case ClassComponent:
|
2834 | candidateType = type;
|
2835 | break;
|
2836 | case ForwardRef:
|
2837 | candidateType = type.render;
|
2838 | break;
|
2839 | default:
|
2840 | break;
|
2841 | }
|
2842 |
|
2843 | if (resolveFamily === null) {
|
2844 | throw new Error('Expected resolveFamily to be set during hot reload.');
|
2845 | }
|
2846 |
|
2847 | var needsRender = false;
|
2848 | var needsRemount = false;
|
2849 | if (candidateType !== null) {
|
2850 | var family = resolveFamily(candidateType);
|
2851 | if (family !== undefined) {
|
2852 | if (staleFamilies.has(family)) {
|
2853 | needsRemount = true;
|
2854 | } else if (updatedFamilies.has(family)) {
|
2855 | needsRender = true;
|
2856 | }
|
2857 | }
|
2858 | }
|
2859 | if (failedBoundaries !== null) {
|
2860 | if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) {
|
2861 | needsRemount = true;
|
2862 | }
|
2863 | }
|
2864 |
|
2865 | if (needsRemount) {
|
2866 | fiber._debugNeedsRemount = true;
|
2867 | }
|
2868 | if (needsRemount || needsRender) {
|
2869 | scheduleWork(fiber, Sync);
|
2870 | }
|
2871 | if (child !== null && !needsRemount) {
|
2872 | scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
|
2873 | }
|
2874 | if (sibling !== null) {
|
2875 | scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
|
2876 | }
|
2877 | }
|
2878 | }
|
2879 |
|
2880 | var findHostInstancesForRefresh = function (root, families) {
|
2881 | {
|
2882 | var hostInstances = new Set();
|
2883 | var types = new Set(families.map(function (family) {
|
2884 | return family.current;
|
2885 | }));
|
2886 | findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances);
|
2887 | return hostInstances;
|
2888 | }
|
2889 | };
|
2890 |
|
2891 | function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
|
2892 | {
|
2893 | var child = fiber.child,
|
2894 | sibling = fiber.sibling,
|
2895 | tag = fiber.tag,
|
2896 | type = fiber.type;
|
2897 |
|
2898 |
|
2899 | var candidateType = null;
|
2900 | switch (tag) {
|
2901 | case FunctionComponent:
|
2902 | case SimpleMemoComponent:
|
2903 | case ClassComponent:
|
2904 | candidateType = type;
|
2905 | break;
|
2906 | case ForwardRef:
|
2907 | candidateType = type.render;
|
2908 | break;
|
2909 | default:
|
2910 | break;
|
2911 | }
|
2912 |
|
2913 | var didMatch = false;
|
2914 | if (candidateType !== null) {
|
2915 | if (types.has(candidateType)) {
|
2916 | didMatch = true;
|
2917 | }
|
2918 | }
|
2919 |
|
2920 | if (didMatch) {
|
2921 |
|
2922 |
|
2923 |
|
2924 | findHostInstancesForFiberShallowly(fiber, hostInstances);
|
2925 | } else {
|
2926 |
|
2927 | if (child !== null) {
|
2928 | findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
|
2929 | }
|
2930 | }
|
2931 |
|
2932 | if (sibling !== null) {
|
2933 | findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
|
2934 | }
|
2935 | }
|
2936 | }
|
2937 |
|
2938 | function findHostInstancesForFiberShallowly(fiber, hostInstances) {
|
2939 | {
|
2940 | var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances);
|
2941 | if (foundHostInstances) {
|
2942 | return;
|
2943 | }
|
2944 |
|
2945 | var node = fiber;
|
2946 | while (true) {
|
2947 | switch (node.tag) {
|
2948 | case HostComponent:
|
2949 | hostInstances.add(node.stateNode);
|
2950 | return;
|
2951 | case HostPortal:
|
2952 | hostInstances.add(node.stateNode.containerInfo);
|
2953 | return;
|
2954 | case HostRoot:
|
2955 | hostInstances.add(node.stateNode.containerInfo);
|
2956 | return;
|
2957 | }
|
2958 | if (node.return === null) {
|
2959 | throw new Error('Expected to reach root first.');
|
2960 | }
|
2961 | node = node.return;
|
2962 | }
|
2963 | }
|
2964 | }
|
2965 |
|
2966 | function findChildHostInstancesForFiberShallowly(fiber, hostInstances) {
|
2967 | {
|
2968 | var node = fiber;
|
2969 | var foundHostInstances = false;
|
2970 | while (true) {
|
2971 | if (node.tag === HostComponent) {
|
2972 |
|
2973 | foundHostInstances = true;
|
2974 | hostInstances.add(node.stateNode);
|
2975 |
|
2976 | } else if (node.child !== null) {
|
2977 | node.child.return = node;
|
2978 | node = node.child;
|
2979 | continue;
|
2980 | }
|
2981 | if (node === fiber) {
|
2982 | return foundHostInstances;
|
2983 | }
|
2984 | while (node.sibling === null) {
|
2985 | if (node.return === null || node.return === fiber) {
|
2986 | return foundHostInstances;
|
2987 | }
|
2988 | node = node.return;
|
2989 | }
|
2990 | node.sibling.return = node.return;
|
2991 | node = node.sibling;
|
2992 | }
|
2993 | }
|
2994 | return false;
|
2995 | }
|
2996 |
|
2997 | function resolveDefaultProps(Component, baseProps) {
|
2998 | if (Component && Component.defaultProps) {
|
2999 |
|
3000 | var props = _assign({}, baseProps);
|
3001 | var defaultProps = Component.defaultProps;
|
3002 | for (var propName in defaultProps) {
|
3003 | if (props[propName] === undefined) {
|
3004 | props[propName] = defaultProps[propName];
|
3005 | }
|
3006 | }
|
3007 | return props;
|
3008 | }
|
3009 | return baseProps;
|
3010 | }
|
3011 |
|
3012 | function readLazyComponentType(lazyComponent) {
|
3013 | var status = lazyComponent._status;
|
3014 | var result = lazyComponent._result;
|
3015 | switch (status) {
|
3016 | case Resolved:
|
3017 | {
|
3018 | var Component = result;
|
3019 | return Component;
|
3020 | }
|
3021 | case Rejected:
|
3022 | {
|
3023 | var error = result;
|
3024 | throw error;
|
3025 | }
|
3026 | case Pending:
|
3027 | {
|
3028 | var thenable = result;
|
3029 | throw thenable;
|
3030 | }
|
3031 | default:
|
3032 | {
|
3033 | lazyComponent._status = Pending;
|
3034 | var ctor = lazyComponent._ctor;
|
3035 | var _thenable = ctor();
|
3036 | _thenable.then(function (moduleObject) {
|
3037 | if (lazyComponent._status === Pending) {
|
3038 | var defaultExport = moduleObject.default;
|
3039 | {
|
3040 | if (defaultExport === undefined) {
|
3041 | warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
|
3042 | }
|
3043 | }
|
3044 | lazyComponent._status = Resolved;
|
3045 | lazyComponent._result = defaultExport;
|
3046 | }
|
3047 | }, function (error) {
|
3048 | if (lazyComponent._status === Pending) {
|
3049 | lazyComponent._status = Rejected;
|
3050 | lazyComponent._result = error;
|
3051 | }
|
3052 | });
|
3053 |
|
3054 | switch (lazyComponent._status) {
|
3055 | case Resolved:
|
3056 | return lazyComponent._result;
|
3057 | case Rejected:
|
3058 | throw lazyComponent._result;
|
3059 | }
|
3060 | lazyComponent._result = _thenable;
|
3061 | throw _thenable;
|
3062 | }
|
3063 | }
|
3064 | }
|
3065 |
|
3066 | var valueCursor = createCursor(null);
|
3067 |
|
3068 | var rendererSigil = void 0;
|
3069 | {
|
3070 |
|
3071 | rendererSigil = {};
|
3072 | }
|
3073 |
|
3074 | var currentlyRenderingFiber = null;
|
3075 | var lastContextDependency = null;
|
3076 | var lastContextWithAllBitsObserved = null;
|
3077 |
|
3078 | var isDisallowedContextReadInDEV = false;
|
3079 |
|
3080 | function resetContextDependencies() {
|
3081 |
|
3082 |
|
3083 | currentlyRenderingFiber = null;
|
3084 | lastContextDependency = null;
|
3085 | lastContextWithAllBitsObserved = null;
|
3086 | {
|
3087 | isDisallowedContextReadInDEV = false;
|
3088 | }
|
3089 | }
|
3090 |
|
3091 | function enterDisallowedContextReadInDEV() {
|
3092 | {
|
3093 | isDisallowedContextReadInDEV = true;
|
3094 | }
|
3095 | }
|
3096 |
|
3097 | function exitDisallowedContextReadInDEV() {
|
3098 | {
|
3099 | isDisallowedContextReadInDEV = false;
|
3100 | }
|
3101 | }
|
3102 |
|
3103 | function pushProvider(providerFiber, nextValue) {
|
3104 | var context = providerFiber.type._context;
|
3105 |
|
3106 | if (isPrimaryRenderer) {
|
3107 | push(valueCursor, context._currentValue, providerFiber);
|
3108 |
|
3109 | context._currentValue = nextValue;
|
3110 | {
|
3111 | !(context._currentRenderer === undefined || context._currentRenderer === null || context._currentRenderer === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
|
3112 | context._currentRenderer = rendererSigil;
|
3113 | }
|
3114 | } else {
|
3115 | push(valueCursor, context._currentValue2, providerFiber);
|
3116 |
|
3117 | context._currentValue2 = nextValue;
|
3118 | {
|
3119 | !(context._currentRenderer2 === undefined || context._currentRenderer2 === null || context._currentRenderer2 === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
|
3120 | context._currentRenderer2 = rendererSigil;
|
3121 | }
|
3122 | }
|
3123 | }
|
3124 |
|
3125 | function popProvider(providerFiber) {
|
3126 | var currentValue = valueCursor.current;
|
3127 |
|
3128 | pop(valueCursor, providerFiber);
|
3129 |
|
3130 | var context = providerFiber.type._context;
|
3131 | if (isPrimaryRenderer) {
|
3132 | context._currentValue = currentValue;
|
3133 | } else {
|
3134 | context._currentValue2 = currentValue;
|
3135 | }
|
3136 | }
|
3137 |
|
3138 | function calculateChangedBits(context, newValue, oldValue) {
|
3139 | if (is(oldValue, newValue)) {
|
3140 |
|
3141 | return 0;
|
3142 | } else {
|
3143 | var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
3144 |
|
3145 | {
|
3146 | !((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits) ? warning$1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
|
3147 | }
|
3148 | return changedBits | 0;
|
3149 | }
|
3150 | }
|
3151 |
|
3152 | function scheduleWorkOnParentPath(parent, renderExpirationTime) {
|
3153 |
|
3154 |
|
3155 | var node = parent;
|
3156 | while (node !== null) {
|
3157 | var alternate = node.alternate;
|
3158 | if (node.childExpirationTime < renderExpirationTime) {
|
3159 | node.childExpirationTime = renderExpirationTime;
|
3160 | if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
3161 | alternate.childExpirationTime = renderExpirationTime;
|
3162 | }
|
3163 | } else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
|
3164 | alternate.childExpirationTime = renderExpirationTime;
|
3165 | } else {
|
3166 |
|
3167 |
|
3168 | break;
|
3169 | }
|
3170 | node = node.return;
|
3171 | }
|
3172 | }
|
3173 |
|
3174 | function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
|
3175 | var fiber = workInProgress.child;
|
3176 | if (fiber !== null) {
|
3177 |
|
3178 | fiber.return = workInProgress;
|
3179 | }
|
3180 | while (fiber !== null) {
|
3181 | var nextFiber = void 0;
|
3182 |
|
3183 |
|
3184 | var list = fiber.dependencies;
|
3185 | if (list !== null) {
|
3186 | nextFiber = fiber.child;
|
3187 |
|
3188 | var dependency = list.firstContext;
|
3189 | while (dependency !== null) {
|
3190 |
|
3191 | if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
|
3192 |
|
3193 |
|
3194 | if (fiber.tag === ClassComponent) {
|
3195 |
|
3196 | var update = createUpdate(renderExpirationTime, null);
|
3197 | update.tag = ForceUpdate;
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 | enqueueUpdate(fiber, update);
|
3203 | }
|
3204 |
|
3205 | if (fiber.expirationTime < renderExpirationTime) {
|
3206 | fiber.expirationTime = renderExpirationTime;
|
3207 | }
|
3208 | var alternate = fiber.alternate;
|
3209 | if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
3210 | alternate.expirationTime = renderExpirationTime;
|
3211 | }
|
3212 |
|
3213 | scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
|
3214 |
|
3215 |
|
3216 | if (list.expirationTime < renderExpirationTime) {
|
3217 | list.expirationTime = renderExpirationTime;
|
3218 | }
|
3219 |
|
3220 |
|
3221 |
|
3222 | break;
|
3223 | }
|
3224 | dependency = dependency.next;
|
3225 | }
|
3226 | } else if (fiber.tag === ContextProvider) {
|
3227 |
|
3228 | nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
|
3229 | } else if (enableSuspenseServerRenderer && fiber.tag === DehydratedSuspenseComponent) {
|
3230 |
|
3231 |
|
3232 |
|
3233 | if (fiber.expirationTime < renderExpirationTime) {
|
3234 | fiber.expirationTime = renderExpirationTime;
|
3235 | }
|
3236 | var _alternate = fiber.alternate;
|
3237 | if (_alternate !== null && _alternate.expirationTime < renderExpirationTime) {
|
3238 | _alternate.expirationTime = renderExpirationTime;
|
3239 | }
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 | scheduleWorkOnParentPath(fiber, renderExpirationTime);
|
3245 | nextFiber = fiber.sibling;
|
3246 | } else {
|
3247 |
|
3248 | nextFiber = fiber.child;
|
3249 | }
|
3250 |
|
3251 | if (nextFiber !== null) {
|
3252 |
|
3253 | nextFiber.return = fiber;
|
3254 | } else {
|
3255 |
|
3256 | nextFiber = fiber;
|
3257 | while (nextFiber !== null) {
|
3258 | if (nextFiber === workInProgress) {
|
3259 |
|
3260 | nextFiber = null;
|
3261 | break;
|
3262 | }
|
3263 | var sibling = nextFiber.sibling;
|
3264 | if (sibling !== null) {
|
3265 |
|
3266 | sibling.return = nextFiber.return;
|
3267 | nextFiber = sibling;
|
3268 | break;
|
3269 | }
|
3270 |
|
3271 | nextFiber = nextFiber.return;
|
3272 | }
|
3273 | }
|
3274 | fiber = nextFiber;
|
3275 | }
|
3276 | }
|
3277 |
|
3278 | function prepareToReadContext(workInProgress, renderExpirationTime) {
|
3279 | currentlyRenderingFiber = workInProgress;
|
3280 | lastContextDependency = null;
|
3281 | lastContextWithAllBitsObserved = null;
|
3282 |
|
3283 | var dependencies = workInProgress.dependencies;
|
3284 | if (dependencies !== null) {
|
3285 | var firstContext = dependencies.firstContext;
|
3286 | if (firstContext !== null) {
|
3287 | if (dependencies.expirationTime >= renderExpirationTime) {
|
3288 |
|
3289 | markWorkInProgressReceivedUpdate();
|
3290 | }
|
3291 |
|
3292 | dependencies.firstContext = null;
|
3293 | }
|
3294 | }
|
3295 | }
|
3296 |
|
3297 | function readContext(context, observedBits) {
|
3298 | {
|
3299 |
|
3300 |
|
3301 | !!isDisallowedContextReadInDEV ? warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().') : void 0;
|
3302 | }
|
3303 |
|
3304 | if (lastContextWithAllBitsObserved === context) {
|
3305 |
|
3306 | } else if (observedBits === false || observedBits === 0) {
|
3307 |
|
3308 | } else {
|
3309 | var resolvedObservedBits = void 0;
|
3310 | if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) {
|
3311 |
|
3312 | lastContextWithAllBitsObserved = context;
|
3313 | resolvedObservedBits = MAX_SIGNED_31_BIT_INT;
|
3314 | } else {
|
3315 | resolvedObservedBits = observedBits;
|
3316 | }
|
3317 |
|
3318 | var contextItem = {
|
3319 | context: context,
|
3320 | observedBits: resolvedObservedBits,
|
3321 | next: null
|
3322 | };
|
3323 |
|
3324 | if (lastContextDependency === null) {
|
3325 | (function () {
|
3326 | if (!(currentlyRenderingFiber !== null)) {
|
3327 | {
|
3328 | throw ReactError(Error('Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().'));
|
3329 | }
|
3330 | }
|
3331 | })();
|
3332 |
|
3333 |
|
3334 | lastContextDependency = contextItem;
|
3335 | currentlyRenderingFiber.dependencies = {
|
3336 | expirationTime: NoWork,
|
3337 | firstContext: contextItem,
|
3338 | responders: null
|
3339 | };
|
3340 | } else {
|
3341 |
|
3342 | lastContextDependency = lastContextDependency.next = contextItem;
|
3343 | }
|
3344 | }
|
3345 | return isPrimaryRenderer ? context._currentValue : context._currentValue2;
|
3346 | }
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 |
|
3378 |
|
3379 |
|
3380 |
|
3381 |
|
3382 |
|
3383 |
|
3384 |
|
3385 |
|
3386 |
|
3387 |
|
3388 |
|
3389 |
|
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 | var UpdateState = 0;
|
3426 | var ReplaceState = 1;
|
3427 | var ForceUpdate = 2;
|
3428 | var CaptureUpdate = 3;
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 | var hasForceUpdate = false;
|
3434 |
|
3435 | var didWarnUpdateInsideUpdate = void 0;
|
3436 | var currentlyProcessingQueue = void 0;
|
3437 |
|
3438 | {
|
3439 | didWarnUpdateInsideUpdate = false;
|
3440 | currentlyProcessingQueue = null;
|
3441 |
|
3442 | }
|
3443 |
|
3444 | function createUpdateQueue(baseState) {
|
3445 | var queue = {
|
3446 | baseState: baseState,
|
3447 | firstUpdate: null,
|
3448 | lastUpdate: null,
|
3449 | firstCapturedUpdate: null,
|
3450 | lastCapturedUpdate: null,
|
3451 | firstEffect: null,
|
3452 | lastEffect: null,
|
3453 | firstCapturedEffect: null,
|
3454 | lastCapturedEffect: null
|
3455 | };
|
3456 | return queue;
|
3457 | }
|
3458 |
|
3459 | function cloneUpdateQueue(currentQueue) {
|
3460 | var queue = {
|
3461 | baseState: currentQueue.baseState,
|
3462 | firstUpdate: currentQueue.firstUpdate,
|
3463 | lastUpdate: currentQueue.lastUpdate,
|
3464 |
|
3465 |
|
3466 |
|
3467 | firstCapturedUpdate: null,
|
3468 | lastCapturedUpdate: null,
|
3469 |
|
3470 | firstEffect: null,
|
3471 | lastEffect: null,
|
3472 |
|
3473 | firstCapturedEffect: null,
|
3474 | lastCapturedEffect: null
|
3475 | };
|
3476 | return queue;
|
3477 | }
|
3478 |
|
3479 | function createUpdate(expirationTime, suspenseConfig) {
|
3480 | var update = {
|
3481 | expirationTime: expirationTime,
|
3482 | suspenseConfig: suspenseConfig,
|
3483 |
|
3484 | tag: UpdateState,
|
3485 | payload: null,
|
3486 | callback: null,
|
3487 |
|
3488 | next: null,
|
3489 | nextEffect: null
|
3490 | };
|
3491 | {
|
3492 | update.priority = getCurrentPriorityLevel();
|
3493 | }
|
3494 | return update;
|
3495 | }
|
3496 |
|
3497 | function appendUpdateToQueue(queue, update) {
|
3498 |
|
3499 | if (queue.lastUpdate === null) {
|
3500 |
|
3501 | queue.firstUpdate = queue.lastUpdate = update;
|
3502 | } else {
|
3503 | queue.lastUpdate.next = update;
|
3504 | queue.lastUpdate = update;
|
3505 | }
|
3506 | }
|
3507 |
|
3508 | function enqueueUpdate(fiber, update) {
|
3509 |
|
3510 | var alternate = fiber.alternate;
|
3511 | var queue1 = void 0;
|
3512 | var queue2 = void 0;
|
3513 | if (alternate === null) {
|
3514 |
|
3515 | queue1 = fiber.updateQueue;
|
3516 | queue2 = null;
|
3517 | if (queue1 === null) {
|
3518 | queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
|
3519 | }
|
3520 | } else {
|
3521 |
|
3522 | queue1 = fiber.updateQueue;
|
3523 | queue2 = alternate.updateQueue;
|
3524 | if (queue1 === null) {
|
3525 | if (queue2 === null) {
|
3526 |
|
3527 | queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
|
3528 | queue2 = alternate.updateQueue = createUpdateQueue(alternate.memoizedState);
|
3529 | } else {
|
3530 |
|
3531 | queue1 = fiber.updateQueue = cloneUpdateQueue(queue2);
|
3532 | }
|
3533 | } else {
|
3534 | if (queue2 === null) {
|
3535 |
|
3536 | queue2 = alternate.updateQueue = cloneUpdateQueue(queue1);
|
3537 | } else {
|
3538 |
|
3539 | }
|
3540 | }
|
3541 | }
|
3542 | if (queue2 === null || queue1 === queue2) {
|
3543 |
|
3544 | appendUpdateToQueue(queue1, update);
|
3545 | } else {
|
3546 |
|
3547 |
|
3548 |
|
3549 | if (queue1.lastUpdate === null || queue2.lastUpdate === null) {
|
3550 |
|
3551 | appendUpdateToQueue(queue1, update);
|
3552 | appendUpdateToQueue(queue2, update);
|
3553 | } else {
|
3554 |
|
3555 |
|
3556 | appendUpdateToQueue(queue1, update);
|
3557 |
|
3558 | queue2.lastUpdate = update;
|
3559 | }
|
3560 | }
|
3561 |
|
3562 | {
|
3563 | if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
|
3564 | warningWithoutStack$1(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
|
3565 | didWarnUpdateInsideUpdate = true;
|
3566 | }
|
3567 | }
|
3568 | }
|
3569 |
|
3570 | function enqueueCapturedUpdate(workInProgress, update) {
|
3571 |
|
3572 |
|
3573 | var workInProgressQueue = workInProgress.updateQueue;
|
3574 | if (workInProgressQueue === null) {
|
3575 | workInProgressQueue = workInProgress.updateQueue = createUpdateQueue(workInProgress.memoizedState);
|
3576 | } else {
|
3577 |
|
3578 |
|
3579 |
|
3580 | workInProgressQueue = ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue);
|
3581 | }
|
3582 |
|
3583 |
|
3584 | if (workInProgressQueue.lastCapturedUpdate === null) {
|
3585 |
|
3586 | workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update;
|
3587 | } else {
|
3588 | workInProgressQueue.lastCapturedUpdate.next = update;
|
3589 | workInProgressQueue.lastCapturedUpdate = update;
|
3590 | }
|
3591 | }
|
3592 |
|
3593 | function ensureWorkInProgressQueueIsAClone(workInProgress, queue) {
|
3594 | var current = workInProgress.alternate;
|
3595 | if (current !== null) {
|
3596 |
|
3597 |
|
3598 | if (queue === current.updateQueue) {
|
3599 | queue = workInProgress.updateQueue = cloneUpdateQueue(queue);
|
3600 | }
|
3601 | }
|
3602 | return queue;
|
3603 | }
|
3604 |
|
3605 | function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) {
|
3606 | switch (update.tag) {
|
3607 | case ReplaceState:
|
3608 | {
|
3609 | var _payload = update.payload;
|
3610 | if (typeof _payload === 'function') {
|
3611 |
|
3612 | {
|
3613 | enterDisallowedContextReadInDEV();
|
3614 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
3615 | _payload.call(instance, prevState, nextProps);
|
3616 | }
|
3617 | }
|
3618 | var nextState = _payload.call(instance, prevState, nextProps);
|
3619 | {
|
3620 | exitDisallowedContextReadInDEV();
|
3621 | }
|
3622 | return nextState;
|
3623 | }
|
3624 |
|
3625 | return _payload;
|
3626 | }
|
3627 | case CaptureUpdate:
|
3628 | {
|
3629 | workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture;
|
3630 | }
|
3631 |
|
3632 | case UpdateState:
|
3633 | {
|
3634 | var _payload2 = update.payload;
|
3635 | var partialState = void 0;
|
3636 | if (typeof _payload2 === 'function') {
|
3637 |
|
3638 | {
|
3639 | enterDisallowedContextReadInDEV();
|
3640 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
3641 | _payload2.call(instance, prevState, nextProps);
|
3642 | }
|
3643 | }
|
3644 | partialState = _payload2.call(instance, prevState, nextProps);
|
3645 | {
|
3646 | exitDisallowedContextReadInDEV();
|
3647 | }
|
3648 | } else {
|
3649 |
|
3650 | partialState = _payload2;
|
3651 | }
|
3652 | if (partialState === null || partialState === undefined) {
|
3653 |
|
3654 | return prevState;
|
3655 | }
|
3656 |
|
3657 | return _assign({}, prevState, partialState);
|
3658 | }
|
3659 | case ForceUpdate:
|
3660 | {
|
3661 | hasForceUpdate = true;
|
3662 | return prevState;
|
3663 | }
|
3664 | }
|
3665 | return prevState;
|
3666 | }
|
3667 |
|
3668 | function processUpdateQueue(workInProgress, queue, props, instance, renderExpirationTime) {
|
3669 | hasForceUpdate = false;
|
3670 |
|
3671 | queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue);
|
3672 |
|
3673 | {
|
3674 | currentlyProcessingQueue = queue;
|
3675 | }
|
3676 |
|
3677 |
|
3678 | var newBaseState = queue.baseState;
|
3679 | var newFirstUpdate = null;
|
3680 | var newExpirationTime = NoWork;
|
3681 |
|
3682 |
|
3683 | var update = queue.firstUpdate;
|
3684 | var resultState = newBaseState;
|
3685 | while (update !== null) {
|
3686 | var updateExpirationTime = update.expirationTime;
|
3687 | if (updateExpirationTime < renderExpirationTime) {
|
3688 |
|
3689 | if (newFirstUpdate === null) {
|
3690 |
|
3691 |
|
3692 | newFirstUpdate = update;
|
3693 |
|
3694 |
|
3695 | newBaseState = resultState;
|
3696 | }
|
3697 |
|
3698 |
|
3699 | if (newExpirationTime < updateExpirationTime) {
|
3700 | newExpirationTime = updateExpirationTime;
|
3701 | }
|
3702 | } else {
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 |
|
3709 |
|
3710 |
|
3711 | markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig);
|
3712 |
|
3713 |
|
3714 | resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
|
3715 | var _callback = update.callback;
|
3716 | if (_callback !== null) {
|
3717 | workInProgress.effectTag |= Callback;
|
3718 |
|
3719 | update.nextEffect = null;
|
3720 | if (queue.lastEffect === null) {
|
3721 | queue.firstEffect = queue.lastEffect = update;
|
3722 | } else {
|
3723 | queue.lastEffect.nextEffect = update;
|
3724 | queue.lastEffect = update;
|
3725 | }
|
3726 | }
|
3727 | }
|
3728 |
|
3729 | update = update.next;
|
3730 | }
|
3731 |
|
3732 |
|
3733 | var newFirstCapturedUpdate = null;
|
3734 | update = queue.firstCapturedUpdate;
|
3735 | while (update !== null) {
|
3736 | var _updateExpirationTime = update.expirationTime;
|
3737 | if (_updateExpirationTime < renderExpirationTime) {
|
3738 |
|
3739 | if (newFirstCapturedUpdate === null) {
|
3740 |
|
3741 |
|
3742 | newFirstCapturedUpdate = update;
|
3743 |
|
3744 |
|
3745 | if (newFirstUpdate === null) {
|
3746 | newBaseState = resultState;
|
3747 | }
|
3748 | }
|
3749 |
|
3750 |
|
3751 | if (newExpirationTime < _updateExpirationTime) {
|
3752 | newExpirationTime = _updateExpirationTime;
|
3753 | }
|
3754 | } else {
|
3755 |
|
3756 |
|
3757 | resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
|
3758 | var _callback2 = update.callback;
|
3759 | if (_callback2 !== null) {
|
3760 | workInProgress.effectTag |= Callback;
|
3761 |
|
3762 | update.nextEffect = null;
|
3763 | if (queue.lastCapturedEffect === null) {
|
3764 | queue.firstCapturedEffect = queue.lastCapturedEffect = update;
|
3765 | } else {
|
3766 | queue.lastCapturedEffect.nextEffect = update;
|
3767 | queue.lastCapturedEffect = update;
|
3768 | }
|
3769 | }
|
3770 | }
|
3771 | update = update.next;
|
3772 | }
|
3773 |
|
3774 | if (newFirstUpdate === null) {
|
3775 | queue.lastUpdate = null;
|
3776 | }
|
3777 | if (newFirstCapturedUpdate === null) {
|
3778 | queue.lastCapturedUpdate = null;
|
3779 | } else {
|
3780 | workInProgress.effectTag |= Callback;
|
3781 | }
|
3782 | if (newFirstUpdate === null && newFirstCapturedUpdate === null) {
|
3783 |
|
3784 |
|
3785 | newBaseState = resultState;
|
3786 | }
|
3787 |
|
3788 | queue.baseState = newBaseState;
|
3789 | queue.firstUpdate = newFirstUpdate;
|
3790 | queue.firstCapturedUpdate = newFirstCapturedUpdate;
|
3791 |
|
3792 |
|
3793 |
|
3794 |
|
3795 |
|
3796 |
|
3797 |
|
3798 |
|
3799 | workInProgress.expirationTime = newExpirationTime;
|
3800 | workInProgress.memoizedState = resultState;
|
3801 |
|
3802 | {
|
3803 | currentlyProcessingQueue = null;
|
3804 | }
|
3805 | }
|
3806 |
|
3807 | function callCallback(callback, context) {
|
3808 | (function () {
|
3809 | if (!(typeof callback === 'function')) {
|
3810 | {
|
3811 | throw ReactError(Error('Invalid argument passed as callback. Expected a function. Instead received: ' + callback));
|
3812 | }
|
3813 | }
|
3814 | })();
|
3815 | callback.call(context);
|
3816 | }
|
3817 |
|
3818 | function resetHasForceUpdateBeforeProcessing() {
|
3819 | hasForceUpdate = false;
|
3820 | }
|
3821 |
|
3822 | function checkHasForceUpdateAfterProcessing() {
|
3823 | return hasForceUpdate;
|
3824 | }
|
3825 |
|
3826 | function commitUpdateQueue(finishedWork, finishedQueue, instance, renderExpirationTime) {
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 | if (finishedQueue.firstCapturedUpdate !== null) {
|
3832 |
|
3833 | if (finishedQueue.lastUpdate !== null) {
|
3834 | finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate;
|
3835 | finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate;
|
3836 | }
|
3837 |
|
3838 | finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null;
|
3839 | }
|
3840 |
|
3841 |
|
3842 | commitUpdateEffects(finishedQueue.firstEffect, instance);
|
3843 | finishedQueue.firstEffect = finishedQueue.lastEffect = null;
|
3844 |
|
3845 | commitUpdateEffects(finishedQueue.firstCapturedEffect, instance);
|
3846 | finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null;
|
3847 | }
|
3848 |
|
3849 | function commitUpdateEffects(effect, instance) {
|
3850 | while (effect !== null) {
|
3851 | var _callback3 = effect.callback;
|
3852 | if (_callback3 !== null) {
|
3853 | effect.callback = null;
|
3854 | callCallback(_callback3, instance);
|
3855 | }
|
3856 | effect = effect.nextEffect;
|
3857 | }
|
3858 | }
|
3859 |
|
3860 | var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
3861 |
|
3862 |
|
3863 | function requestCurrentSuspenseConfig() {
|
3864 | return ReactCurrentBatchConfig.suspense;
|
3865 | }
|
3866 |
|
3867 | var fakeInternalInstance = {};
|
3868 | var isArray$1 = Array.isArray;
|
3869 |
|
3870 |
|
3871 |
|
3872 | var emptyRefsObject = new React.Component().refs;
|
3873 |
|
3874 | var didWarnAboutStateAssignmentForComponent = void 0;
|
3875 | var didWarnAboutUninitializedState = void 0;
|
3876 | var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
|
3877 | var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
|
3878 | var didWarnAboutUndefinedDerivedState = void 0;
|
3879 | var warnOnUndefinedDerivedState = void 0;
|
3880 | var warnOnInvalidCallback = void 0;
|
3881 | var didWarnAboutDirectlyAssigningPropsToState = void 0;
|
3882 | var didWarnAboutContextTypeAndContextTypes = void 0;
|
3883 | var didWarnAboutInvalidateContextType = void 0;
|
3884 |
|
3885 | {
|
3886 | didWarnAboutStateAssignmentForComponent = new Set();
|
3887 | didWarnAboutUninitializedState = new Set();
|
3888 | didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
|
3889 | didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
|
3890 | didWarnAboutDirectlyAssigningPropsToState = new Set();
|
3891 | didWarnAboutUndefinedDerivedState = new Set();
|
3892 | didWarnAboutContextTypeAndContextTypes = new Set();
|
3893 | didWarnAboutInvalidateContextType = new Set();
|
3894 |
|
3895 | var didWarnOnInvalidCallback = new Set();
|
3896 |
|
3897 | warnOnInvalidCallback = function (callback, callerName) {
|
3898 | if (callback === null || typeof callback === 'function') {
|
3899 | return;
|
3900 | }
|
3901 | var key = callerName + '_' + callback;
|
3902 | if (!didWarnOnInvalidCallback.has(key)) {
|
3903 | didWarnOnInvalidCallback.add(key);
|
3904 | warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
|
3905 | }
|
3906 | };
|
3907 |
|
3908 | warnOnUndefinedDerivedState = function (type, partialState) {
|
3909 | if (partialState === undefined) {
|
3910 | var componentName = getComponentName(type) || 'Component';
|
3911 | if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
|
3912 | didWarnAboutUndefinedDerivedState.add(componentName);
|
3913 | warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
|
3914 | }
|
3915 | }
|
3916 | };
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 | Object.defineProperty(fakeInternalInstance, '_processChildContext', {
|
3924 | enumerable: false,
|
3925 | value: function () {
|
3926 | (function () {
|
3927 | {
|
3928 | {
|
3929 | throw ReactError(Error('_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn\'t supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).'));
|
3930 | }
|
3931 | }
|
3932 | })();
|
3933 | }
|
3934 | });
|
3935 | Object.freeze(fakeInternalInstance);
|
3936 | }
|
3937 |
|
3938 | function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
|
3939 | var prevState = workInProgress.memoizedState;
|
3940 |
|
3941 | {
|
3942 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
3943 |
|
3944 | getDerivedStateFromProps(nextProps, prevState);
|
3945 | }
|
3946 | }
|
3947 |
|
3948 | var partialState = getDerivedStateFromProps(nextProps, prevState);
|
3949 |
|
3950 | {
|
3951 | warnOnUndefinedDerivedState(ctor, partialState);
|
3952 | }
|
3953 |
|
3954 | var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
|
3955 | workInProgress.memoizedState = memoizedState;
|
3956 |
|
3957 |
|
3958 |
|
3959 | var updateQueue = workInProgress.updateQueue;
|
3960 | if (updateQueue !== null && workInProgress.expirationTime === NoWork) {
|
3961 | updateQueue.baseState = memoizedState;
|
3962 | }
|
3963 | }
|
3964 |
|
3965 | var classComponentUpdater = {
|
3966 | isMounted: isMounted,
|
3967 | enqueueSetState: function (inst, payload, callback) {
|
3968 | var fiber = get(inst);
|
3969 | var currentTime = requestCurrentTime();
|
3970 | var suspenseConfig = requestCurrentSuspenseConfig();
|
3971 | var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
3972 |
|
3973 | var update = createUpdate(expirationTime, suspenseConfig);
|
3974 | update.payload = payload;
|
3975 | if (callback !== undefined && callback !== null) {
|
3976 | {
|
3977 | warnOnInvalidCallback(callback, 'setState');
|
3978 | }
|
3979 | update.callback = callback;
|
3980 | }
|
3981 |
|
3982 | if (revertPassiveEffectsChange) {
|
3983 | flushPassiveEffects();
|
3984 | }
|
3985 | enqueueUpdate(fiber, update);
|
3986 | scheduleWork(fiber, expirationTime);
|
3987 | },
|
3988 | enqueueReplaceState: function (inst, payload, callback) {
|
3989 | var fiber = get(inst);
|
3990 | var currentTime = requestCurrentTime();
|
3991 | var suspenseConfig = requestCurrentSuspenseConfig();
|
3992 | var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
3993 |
|
3994 | var update = createUpdate(expirationTime, suspenseConfig);
|
3995 | update.tag = ReplaceState;
|
3996 | update.payload = payload;
|
3997 |
|
3998 | if (callback !== undefined && callback !== null) {
|
3999 | {
|
4000 | warnOnInvalidCallback(callback, 'replaceState');
|
4001 | }
|
4002 | update.callback = callback;
|
4003 | }
|
4004 |
|
4005 | if (revertPassiveEffectsChange) {
|
4006 | flushPassiveEffects();
|
4007 | }
|
4008 | enqueueUpdate(fiber, update);
|
4009 | scheduleWork(fiber, expirationTime);
|
4010 | },
|
4011 | enqueueForceUpdate: function (inst, callback) {
|
4012 | var fiber = get(inst);
|
4013 | var currentTime = requestCurrentTime();
|
4014 | var suspenseConfig = requestCurrentSuspenseConfig();
|
4015 | var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
|
4016 |
|
4017 | var update = createUpdate(expirationTime, suspenseConfig);
|
4018 | update.tag = ForceUpdate;
|
4019 |
|
4020 | if (callback !== undefined && callback !== null) {
|
4021 | {
|
4022 | warnOnInvalidCallback(callback, 'forceUpdate');
|
4023 | }
|
4024 | update.callback = callback;
|
4025 | }
|
4026 |
|
4027 | if (revertPassiveEffectsChange) {
|
4028 | flushPassiveEffects();
|
4029 | }
|
4030 | enqueueUpdate(fiber, update);
|
4031 | scheduleWork(fiber, expirationTime);
|
4032 | }
|
4033 | };
|
4034 |
|
4035 | function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
|
4036 | var instance = workInProgress.stateNode;
|
4037 | if (typeof instance.shouldComponentUpdate === 'function') {
|
4038 | startPhaseTimer(workInProgress, 'shouldComponentUpdate');
|
4039 | var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
|
4040 | stopPhaseTimer();
|
4041 |
|
4042 | {
|
4043 | !(shouldUpdate !== undefined) ? warningWithoutStack$1(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component') : void 0;
|
4044 | }
|
4045 |
|
4046 | return shouldUpdate;
|
4047 | }
|
4048 |
|
4049 | if (ctor.prototype && ctor.prototype.isPureReactComponent) {
|
4050 | return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
|
4051 | }
|
4052 |
|
4053 | return true;
|
4054 | }
|
4055 |
|
4056 | function checkClassInstance(workInProgress, ctor, newProps) {
|
4057 | var instance = workInProgress.stateNode;
|
4058 | {
|
4059 | var name = getComponentName(ctor) || 'Component';
|
4060 | var renderPresent = instance.render;
|
4061 |
|
4062 | if (!renderPresent) {
|
4063 | if (ctor.prototype && typeof ctor.prototype.render === 'function') {
|
4064 | warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
|
4065 | } else {
|
4066 | warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
|
4067 | }
|
4068 | }
|
4069 |
|
4070 | var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
|
4071 | !noGetInitialStateOnES6 ? warningWithoutStack$1(false, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name) : void 0;
|
4072 | var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
|
4073 | !noGetDefaultPropsOnES6 ? warningWithoutStack$1(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
|
4074 | var noInstancePropTypes = !instance.propTypes;
|
4075 | !noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
|
4076 | var noInstanceContextType = !instance.contextType;
|
4077 | !noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
|
4078 |
|
4079 | if (disableLegacyContext) {
|
4080 | if (ctor.childContextTypes) {
|
4081 | warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', name);
|
4082 | }
|
4083 | if (ctor.contextTypes) {
|
4084 | warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', name);
|
4085 | }
|
4086 | } else {
|
4087 | var noInstanceContextTypes = !instance.contextTypes;
|
4088 | !noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
|
4089 |
|
4090 | if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
|
4091 | didWarnAboutContextTypeAndContextTypes.add(ctor);
|
4092 | warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
|
4093 | }
|
4094 | }
|
4095 |
|
4096 | var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
|
4097 | !noComponentShouldUpdate ? warningWithoutStack$1(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
|
4098 | if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
|
4099 | warningWithoutStack$1(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component');
|
4100 | }
|
4101 | var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
|
4102 | !noComponentDidUnmount ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
|
4103 | var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
|
4104 | !noComponentDidReceiveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0;
|
4105 | var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
|
4106 | !noComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
|
4107 | var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
|
4108 | !noUnsafeComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
|
4109 | var hasMutatedProps = instance.props !== newProps;
|
4110 | !(instance.props === undefined || !hasMutatedProps) ? warningWithoutStack$1(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0;
|
4111 | var noInstanceDefaultProps = !instance.defaultProps;
|
4112 | !noInstanceDefaultProps ? warningWithoutStack$1(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0;
|
4113 |
|
4114 | if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
|
4115 | didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
|
4116 | warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
|
4117 | }
|
4118 |
|
4119 | var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
|
4120 | !noInstanceGetDerivedStateFromProps ? warningWithoutStack$1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
|
4121 | var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
|
4122 | !noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
|
4123 | var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
|
4124 | !noStaticGetSnapshotBeforeUpdate ? warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
|
4125 | var _state = instance.state;
|
4126 | if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
|
4127 | warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
|
4128 | }
|
4129 | if (typeof instance.getChildContext === 'function') {
|
4130 | !(typeof ctor.childContextTypes === 'object') ? warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
|
4131 | }
|
4132 | }
|
4133 | }
|
4134 |
|
4135 | function adoptClassInstance(workInProgress, instance) {
|
4136 | instance.updater = classComponentUpdater;
|
4137 | workInProgress.stateNode = instance;
|
4138 |
|
4139 | set(instance, workInProgress);
|
4140 | {
|
4141 | instance._reactInternalInstance = fakeInternalInstance;
|
4142 | }
|
4143 | }
|
4144 |
|
4145 | function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
|
4146 | var isLegacyContextConsumer = false;
|
4147 | var unmaskedContext = emptyContextObject;
|
4148 | var context = emptyContextObject;
|
4149 | var contextType = ctor.contextType;
|
4150 |
|
4151 | {
|
4152 | if ('contextType' in ctor) {
|
4153 | var isValid =
|
4154 |
|
4155 | contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined;
|
4156 |
|
4157 | if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
|
4158 | didWarnAboutInvalidateContextType.add(ctor);
|
4159 |
|
4160 | var addendum = '';
|
4161 | if (contextType === undefined) {
|
4162 | addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
|
4163 | } else if (typeof contextType !== 'object') {
|
4164 | addendum = ' However, it is set to a ' + typeof contextType + '.';
|
4165 | } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
4166 | addendum = ' Did you accidentally pass the Context.Provider instead?';
|
4167 | } else if (contextType._context !== undefined) {
|
4168 |
|
4169 | addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
4170 | } else {
|
4171 | addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
4172 | }
|
4173 | warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum);
|
4174 | }
|
4175 | }
|
4176 | }
|
4177 |
|
4178 | if (typeof contextType === 'object' && contextType !== null) {
|
4179 | context = readContext(contextType);
|
4180 | } else if (!disableLegacyContext) {
|
4181 | unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
4182 | var contextTypes = ctor.contextTypes;
|
4183 | isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
|
4184 | context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
|
4185 | }
|
4186 |
|
4187 |
|
4188 | {
|
4189 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
4190 | new ctor(props, context);
|
4191 | }
|
4192 | }
|
4193 |
|
4194 | var instance = new ctor(props, context);
|
4195 | var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
|
4196 | adoptClassInstance(workInProgress, instance);
|
4197 |
|
4198 | {
|
4199 | if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
|
4200 | var componentName = getComponentName(ctor) || 'Component';
|
4201 | if (!didWarnAboutUninitializedState.has(componentName)) {
|
4202 | didWarnAboutUninitializedState.add(componentName);
|
4203 | warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
|
4204 | }
|
4205 | }
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 | if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
|
4211 | var foundWillMountName = null;
|
4212 | var foundWillReceivePropsName = null;
|
4213 | var foundWillUpdateName = null;
|
4214 | if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
4215 | foundWillMountName = 'componentWillMount';
|
4216 | } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
4217 | foundWillMountName = 'UNSAFE_componentWillMount';
|
4218 | }
|
4219 | if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
4220 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
4221 | } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
4222 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
4223 | }
|
4224 | if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
4225 | foundWillUpdateName = 'componentWillUpdate';
|
4226 | } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
4227 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
4228 | }
|
4229 | if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
|
4230 | var _componentName = getComponentName(ctor) || 'Component';
|
4231 | var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
|
4232 | if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
|
4233 | didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
|
4234 | warningWithoutStack$1(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '');
|
4235 | }
|
4236 | }
|
4237 | }
|
4238 | }
|
4239 |
|
4240 |
|
4241 |
|
4242 | if (isLegacyContextConsumer) {
|
4243 | cacheContext(workInProgress, unmaskedContext, context);
|
4244 | }
|
4245 |
|
4246 | return instance;
|
4247 | }
|
4248 |
|
4249 | function callComponentWillMount(workInProgress, instance) {
|
4250 | startPhaseTimer(workInProgress, 'componentWillMount');
|
4251 | var oldState = instance.state;
|
4252 |
|
4253 | if (typeof instance.componentWillMount === 'function') {
|
4254 | instance.componentWillMount();
|
4255 | }
|
4256 | if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
4257 | instance.UNSAFE_componentWillMount();
|
4258 | }
|
4259 |
|
4260 | stopPhaseTimer();
|
4261 |
|
4262 | if (oldState !== instance.state) {
|
4263 | {
|
4264 | warningWithoutStack$1(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
|
4265 | }
|
4266 | classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
4267 | }
|
4268 | }
|
4269 |
|
4270 | function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
|
4271 | var oldState = instance.state;
|
4272 | startPhaseTimer(workInProgress, 'componentWillReceiveProps');
|
4273 | if (typeof instance.componentWillReceiveProps === 'function') {
|
4274 | instance.componentWillReceiveProps(newProps, nextContext);
|
4275 | }
|
4276 | if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
4277 | instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
|
4278 | }
|
4279 | stopPhaseTimer();
|
4280 |
|
4281 | if (instance.state !== oldState) {
|
4282 | {
|
4283 | var componentName = getComponentName(workInProgress.type) || 'Component';
|
4284 | if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
|
4285 | didWarnAboutStateAssignmentForComponent.add(componentName);
|
4286 | warningWithoutStack$1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
|
4287 | }
|
4288 | }
|
4289 | classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
4290 | }
|
4291 | }
|
4292 |
|
4293 |
|
4294 | function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
|
4295 | {
|
4296 | checkClassInstance(workInProgress, ctor, newProps);
|
4297 | }
|
4298 |
|
4299 | var instance = workInProgress.stateNode;
|
4300 | instance.props = newProps;
|
4301 | instance.state = workInProgress.memoizedState;
|
4302 | instance.refs = emptyRefsObject;
|
4303 |
|
4304 | var contextType = ctor.contextType;
|
4305 | if (typeof contextType === 'object' && contextType !== null) {
|
4306 | instance.context = readContext(contextType);
|
4307 | } else if (disableLegacyContext) {
|
4308 | instance.context = emptyContextObject;
|
4309 | } else {
|
4310 | var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
4311 | instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
4312 | }
|
4313 |
|
4314 | {
|
4315 | if (instance.state === newProps) {
|
4316 | var componentName = getComponentName(ctor) || 'Component';
|
4317 | if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
|
4318 | didWarnAboutDirectlyAssigningPropsToState.add(componentName);
|
4319 | warningWithoutStack$1(false, '%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
|
4320 | }
|
4321 | }
|
4322 |
|
4323 | if (workInProgress.mode & StrictMode) {
|
4324 | ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
|
4325 | }
|
4326 |
|
4327 | if (warnAboutDeprecatedLifecycles) {
|
4328 | ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
|
4329 | }
|
4330 | }
|
4331 |
|
4332 | var updateQueue = workInProgress.updateQueue;
|
4333 | if (updateQueue !== null) {
|
4334 | processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
|
4335 | instance.state = workInProgress.memoizedState;
|
4336 | }
|
4337 |
|
4338 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
4339 | if (typeof getDerivedStateFromProps === 'function') {
|
4340 | applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
|
4341 | instance.state = workInProgress.memoizedState;
|
4342 | }
|
4343 |
|
4344 |
|
4345 |
|
4346 | if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
|
4347 | callComponentWillMount(workInProgress, instance);
|
4348 |
|
4349 |
|
4350 | updateQueue = workInProgress.updateQueue;
|
4351 | if (updateQueue !== null) {
|
4352 | processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
|
4353 | instance.state = workInProgress.memoizedState;
|
4354 | }
|
4355 | }
|
4356 |
|
4357 | if (typeof instance.componentDidMount === 'function') {
|
4358 | workInProgress.effectTag |= Update;
|
4359 | }
|
4360 | }
|
4361 |
|
4362 | function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
|
4363 | var instance = workInProgress.stateNode;
|
4364 |
|
4365 | var oldProps = workInProgress.memoizedProps;
|
4366 | instance.props = oldProps;
|
4367 |
|
4368 | var oldContext = instance.context;
|
4369 | var contextType = ctor.contextType;
|
4370 | var nextContext = emptyContextObject;
|
4371 | if (typeof contextType === 'object' && contextType !== null) {
|
4372 | nextContext = readContext(contextType);
|
4373 | } else if (!disableLegacyContext) {
|
4374 | var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
4375 | nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
|
4376 | }
|
4377 |
|
4378 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
4379 | var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
4380 |
|
4381 |
|
4382 |
|
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
4388 | if (oldProps !== newProps || oldContext !== nextContext) {
|
4389 | callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
|
4390 | }
|
4391 | }
|
4392 |
|
4393 | resetHasForceUpdateBeforeProcessing();
|
4394 |
|
4395 | var oldState = workInProgress.memoizedState;
|
4396 | var newState = instance.state = oldState;
|
4397 | var updateQueue = workInProgress.updateQueue;
|
4398 | if (updateQueue !== null) {
|
4399 | processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
|
4400 | newState = workInProgress.memoizedState;
|
4401 | }
|
4402 | if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
|
4403 |
|
4404 |
|
4405 | if (typeof instance.componentDidMount === 'function') {
|
4406 | workInProgress.effectTag |= Update;
|
4407 | }
|
4408 | return false;
|
4409 | }
|
4410 |
|
4411 | if (typeof getDerivedStateFromProps === 'function') {
|
4412 | applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
|
4413 | newState = workInProgress.memoizedState;
|
4414 | }
|
4415 |
|
4416 | var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
|
4417 |
|
4418 | if (shouldUpdate) {
|
4419 |
|
4420 |
|
4421 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
|
4422 | startPhaseTimer(workInProgress, 'componentWillMount');
|
4423 | if (typeof instance.componentWillMount === 'function') {
|
4424 | instance.componentWillMount();
|
4425 | }
|
4426 | if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
4427 | instance.UNSAFE_componentWillMount();
|
4428 | }
|
4429 | stopPhaseTimer();
|
4430 | }
|
4431 | if (typeof instance.componentDidMount === 'function') {
|
4432 | workInProgress.effectTag |= Update;
|
4433 | }
|
4434 | } else {
|
4435 |
|
4436 |
|
4437 | if (typeof instance.componentDidMount === 'function') {
|
4438 | workInProgress.effectTag |= Update;
|
4439 | }
|
4440 |
|
4441 |
|
4442 |
|
4443 | workInProgress.memoizedProps = newProps;
|
4444 | workInProgress.memoizedState = newState;
|
4445 | }
|
4446 |
|
4447 |
|
4448 |
|
4449 | instance.props = newProps;
|
4450 | instance.state = newState;
|
4451 | instance.context = nextContext;
|
4452 |
|
4453 | return shouldUpdate;
|
4454 | }
|
4455 |
|
4456 |
|
4457 | function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
|
4458 | var instance = workInProgress.stateNode;
|
4459 |
|
4460 | var oldProps = workInProgress.memoizedProps;
|
4461 | instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
|
4462 |
|
4463 | var oldContext = instance.context;
|
4464 | var contextType = ctor.contextType;
|
4465 | var nextContext = emptyContextObject;
|
4466 | if (typeof contextType === 'object' && contextType !== null) {
|
4467 | nextContext = readContext(contextType);
|
4468 | } else if (!disableLegacyContext) {
|
4469 | var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
|
4470 | nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
|
4471 | }
|
4472 |
|
4473 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
4474 | var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
|
4475 |
|
4476 |
|
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
|
4483 | if (oldProps !== newProps || oldContext !== nextContext) {
|
4484 | callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
|
4485 | }
|
4486 | }
|
4487 |
|
4488 | resetHasForceUpdateBeforeProcessing();
|
4489 |
|
4490 | var oldState = workInProgress.memoizedState;
|
4491 | var newState = instance.state = oldState;
|
4492 | var updateQueue = workInProgress.updateQueue;
|
4493 | if (updateQueue !== null) {
|
4494 | processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
|
4495 | newState = workInProgress.memoizedState;
|
4496 | }
|
4497 |
|
4498 | if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
|
4499 |
|
4500 |
|
4501 | if (typeof instance.componentDidUpdate === 'function') {
|
4502 | if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
4503 | workInProgress.effectTag |= Update;
|
4504 | }
|
4505 | }
|
4506 | if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
4507 | if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
4508 | workInProgress.effectTag |= Snapshot;
|
4509 | }
|
4510 | }
|
4511 | return false;
|
4512 | }
|
4513 |
|
4514 | if (typeof getDerivedStateFromProps === 'function') {
|
4515 | applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
|
4516 | newState = workInProgress.memoizedState;
|
4517 | }
|
4518 |
|
4519 | var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
|
4520 |
|
4521 | if (shouldUpdate) {
|
4522 |
|
4523 |
|
4524 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
|
4525 | startPhaseTimer(workInProgress, 'componentWillUpdate');
|
4526 | if (typeof instance.componentWillUpdate === 'function') {
|
4527 | instance.componentWillUpdate(newProps, newState, nextContext);
|
4528 | }
|
4529 | if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
4530 | instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
|
4531 | }
|
4532 | stopPhaseTimer();
|
4533 | }
|
4534 | if (typeof instance.componentDidUpdate === 'function') {
|
4535 | workInProgress.effectTag |= Update;
|
4536 | }
|
4537 | if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
4538 | workInProgress.effectTag |= Snapshot;
|
4539 | }
|
4540 | } else {
|
4541 |
|
4542 |
|
4543 | if (typeof instance.componentDidUpdate === 'function') {
|
4544 | if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
4545 | workInProgress.effectTag |= Update;
|
4546 | }
|
4547 | }
|
4548 | if (typeof instance.getSnapshotBeforeUpdate === 'function') {
|
4549 | if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
|
4550 | workInProgress.effectTag |= Snapshot;
|
4551 | }
|
4552 | }
|
4553 |
|
4554 |
|
4555 |
|
4556 | workInProgress.memoizedProps = newProps;
|
4557 | workInProgress.memoizedState = newState;
|
4558 | }
|
4559 |
|
4560 |
|
4561 |
|
4562 | instance.props = newProps;
|
4563 | instance.state = newState;
|
4564 | instance.context = nextContext;
|
4565 |
|
4566 | return shouldUpdate;
|
4567 | }
|
4568 |
|
4569 | var didWarnAboutMaps = void 0;
|
4570 | var didWarnAboutGenerators = void 0;
|
4571 | var didWarnAboutStringRefInStrictMode = void 0;
|
4572 | var ownerHasKeyUseWarning = void 0;
|
4573 | var ownerHasFunctionTypeWarning = void 0;
|
4574 | var warnForMissingKey = function (child) {};
|
4575 |
|
4576 | {
|
4577 | didWarnAboutMaps = false;
|
4578 | didWarnAboutGenerators = false;
|
4579 | didWarnAboutStringRefInStrictMode = {};
|
4580 |
|
4581 | |
4582 |
|
4583 |
|
4584 |
|
4585 |
|
4586 | ownerHasKeyUseWarning = {};
|
4587 | ownerHasFunctionTypeWarning = {};
|
4588 |
|
4589 | warnForMissingKey = function (child) {
|
4590 | if (child === null || typeof child !== 'object') {
|
4591 | return;
|
4592 | }
|
4593 | if (!child._store || child._store.validated || child.key != null) {
|
4594 | return;
|
4595 | }
|
4596 | (function () {
|
4597 | if (!(typeof child._store === 'object')) {
|
4598 | {
|
4599 | throw ReactError(Error('React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.'));
|
4600 | }
|
4601 | }
|
4602 | })();
|
4603 | child._store.validated = true;
|
4604 |
|
4605 | var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
|
4606 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
4607 | return;
|
4608 | }
|
4609 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
4610 |
|
4611 | warning$1(false, 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
|
4612 | };
|
4613 | }
|
4614 |
|
4615 | var isArray = Array.isArray;
|
4616 |
|
4617 | function coerceRef(returnFiber, current$$1, element) {
|
4618 | var mixedRef = element.ref;
|
4619 | if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
|
4620 | {
|
4621 | if (returnFiber.mode & StrictMode) {
|
4622 | var componentName = getComponentName(returnFiber.type) || 'Component';
|
4623 | if (!didWarnAboutStringRefInStrictMode[componentName]) {
|
4624 | warningWithoutStack$1(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackByFiberInDevAndProd(returnFiber));
|
4625 | didWarnAboutStringRefInStrictMode[componentName] = true;
|
4626 | }
|
4627 | }
|
4628 | }
|
4629 |
|
4630 | if (element._owner) {
|
4631 | var owner = element._owner;
|
4632 | var inst = void 0;
|
4633 | if (owner) {
|
4634 | var ownerFiber = owner;
|
4635 | (function () {
|
4636 | if (!(ownerFiber.tag === ClassComponent)) {
|
4637 | {
|
4638 | throw ReactError(Error('Function components cannot have refs. Did you mean to use React.forwardRef()?'));
|
4639 | }
|
4640 | }
|
4641 | })();
|
4642 | inst = ownerFiber.stateNode;
|
4643 | }
|
4644 | (function () {
|
4645 | if (!inst) {
|
4646 | {
|
4647 | throw ReactError(Error('Missing owner for string ref ' + mixedRef + '. This error is likely caused by a bug in React. Please file an issue.'));
|
4648 | }
|
4649 | }
|
4650 | })();
|
4651 | var stringRef = '' + mixedRef;
|
4652 |
|
4653 | if (current$$1 !== null && current$$1.ref !== null && typeof current$$1.ref === 'function' && current$$1.ref._stringRef === stringRef) {
|
4654 | return current$$1.ref;
|
4655 | }
|
4656 | var ref = function (value) {
|
4657 | var refs = inst.refs;
|
4658 | if (refs === emptyRefsObject) {
|
4659 |
|
4660 | refs = inst.refs = {};
|
4661 | }
|
4662 | if (value === null) {
|
4663 | delete refs[stringRef];
|
4664 | } else {
|
4665 | refs[stringRef] = value;
|
4666 | }
|
4667 | };
|
4668 | ref._stringRef = stringRef;
|
4669 | return ref;
|
4670 | } else {
|
4671 | (function () {
|
4672 | if (!(typeof mixedRef === 'string')) {
|
4673 | {
|
4674 | throw ReactError(Error('Expected ref to be a function, a string, an object returned by React.createRef(), or null.'));
|
4675 | }
|
4676 | }
|
4677 | })();
|
4678 | (function () {
|
4679 | if (!element._owner) {
|
4680 | {
|
4681 | throw ReactError(Error('Element ref was specified as a string (' + mixedRef + ') but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.'));
|
4682 | }
|
4683 | }
|
4684 | })();
|
4685 | }
|
4686 | }
|
4687 | return mixedRef;
|
4688 | }
|
4689 |
|
4690 | function throwOnInvalidObjectType(returnFiber, newChild) {
|
4691 | if (returnFiber.type !== 'textarea') {
|
4692 | var addendum = '';
|
4693 | {
|
4694 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
|
4695 | }
|
4696 | (function () {
|
4697 | {
|
4698 | {
|
4699 | throw ReactError(Error('Objects are not valid as a React child (found: ' + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ').' + addendum));
|
4700 | }
|
4701 | }
|
4702 | })();
|
4703 | }
|
4704 | }
|
4705 |
|
4706 | function warnOnFunctionType() {
|
4707 | var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev();
|
4708 |
|
4709 | if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
|
4710 | return;
|
4711 | }
|
4712 | ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
|
4713 |
|
4714 | warning$1(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
|
4715 | }
|
4716 |
|
4717 |
|
4718 |
|
4719 |
|
4720 |
|
4721 | function ChildReconciler(shouldTrackSideEffects) {
|
4722 | function deleteChild(returnFiber, childToDelete) {
|
4723 | if (!shouldTrackSideEffects) {
|
4724 |
|
4725 | return;
|
4726 | }
|
4727 |
|
4728 |
|
4729 |
|
4730 |
|
4731 |
|
4732 | var last = returnFiber.lastEffect;
|
4733 | if (last !== null) {
|
4734 | last.nextEffect = childToDelete;
|
4735 | returnFiber.lastEffect = childToDelete;
|
4736 | } else {
|
4737 | returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
|
4738 | }
|
4739 | childToDelete.nextEffect = null;
|
4740 | childToDelete.effectTag = Deletion;
|
4741 | }
|
4742 |
|
4743 | function deleteRemainingChildren(returnFiber, currentFirstChild) {
|
4744 | if (!shouldTrackSideEffects) {
|
4745 |
|
4746 | return null;
|
4747 | }
|
4748 |
|
4749 |
|
4750 |
|
4751 | var childToDelete = currentFirstChild;
|
4752 | while (childToDelete !== null) {
|
4753 | deleteChild(returnFiber, childToDelete);
|
4754 | childToDelete = childToDelete.sibling;
|
4755 | }
|
4756 | return null;
|
4757 | }
|
4758 |
|
4759 | function mapRemainingChildren(returnFiber, currentFirstChild) {
|
4760 |
|
4761 |
|
4762 | var existingChildren = new Map();
|
4763 |
|
4764 | var existingChild = currentFirstChild;
|
4765 | while (existingChild !== null) {
|
4766 | if (existingChild.key !== null) {
|
4767 | existingChildren.set(existingChild.key, existingChild);
|
4768 | } else {
|
4769 | existingChildren.set(existingChild.index, existingChild);
|
4770 | }
|
4771 | existingChild = existingChild.sibling;
|
4772 | }
|
4773 | return existingChildren;
|
4774 | }
|
4775 |
|
4776 | function useFiber(fiber, pendingProps, expirationTime) {
|
4777 |
|
4778 |
|
4779 | var clone = createWorkInProgress(fiber, pendingProps, expirationTime);
|
4780 | clone.index = 0;
|
4781 | clone.sibling = null;
|
4782 | return clone;
|
4783 | }
|
4784 |
|
4785 | function placeChild(newFiber, lastPlacedIndex, newIndex) {
|
4786 | newFiber.index = newIndex;
|
4787 | if (!shouldTrackSideEffects) {
|
4788 |
|
4789 | return lastPlacedIndex;
|
4790 | }
|
4791 | var current$$1 = newFiber.alternate;
|
4792 | if (current$$1 !== null) {
|
4793 | var oldIndex = current$$1.index;
|
4794 | if (oldIndex < lastPlacedIndex) {
|
4795 |
|
4796 | newFiber.effectTag = Placement;
|
4797 | return lastPlacedIndex;
|
4798 | } else {
|
4799 |
|
4800 | return oldIndex;
|
4801 | }
|
4802 | } else {
|
4803 |
|
4804 | newFiber.effectTag = Placement;
|
4805 | return lastPlacedIndex;
|
4806 | }
|
4807 | }
|
4808 |
|
4809 | function placeSingleChild(newFiber) {
|
4810 |
|
4811 |
|
4812 | if (shouldTrackSideEffects && newFiber.alternate === null) {
|
4813 | newFiber.effectTag = Placement;
|
4814 | }
|
4815 | return newFiber;
|
4816 | }
|
4817 |
|
4818 | function updateTextNode(returnFiber, current$$1, textContent, expirationTime) {
|
4819 | if (current$$1 === null || current$$1.tag !== HostText) {
|
4820 |
|
4821 | var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
|
4822 | created.return = returnFiber;
|
4823 | return created;
|
4824 | } else {
|
4825 |
|
4826 | var existing = useFiber(current$$1, textContent, expirationTime);
|
4827 | existing.return = returnFiber;
|
4828 | return existing;
|
4829 | }
|
4830 | }
|
4831 |
|
4832 | function updateElement(returnFiber, current$$1, element, expirationTime) {
|
4833 | if (current$$1 !== null && (current$$1.elementType === element.type || (
|
4834 |
|
4835 | isCompatibleFamilyForHotReloading(current$$1, element)))) {
|
4836 |
|
4837 | var existing = useFiber(current$$1, element.props, expirationTime);
|
4838 | existing.ref = coerceRef(returnFiber, current$$1, element);
|
4839 | existing.return = returnFiber;
|
4840 | {
|
4841 | existing._debugSource = element._source;
|
4842 | existing._debugOwner = element._owner;
|
4843 | }
|
4844 | return existing;
|
4845 | } else {
|
4846 |
|
4847 | var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
|
4848 | created.ref = coerceRef(returnFiber, current$$1, element);
|
4849 | created.return = returnFiber;
|
4850 | return created;
|
4851 | }
|
4852 | }
|
4853 |
|
4854 | function updatePortal(returnFiber, current$$1, portal, expirationTime) {
|
4855 | if (current$$1 === null || current$$1.tag !== HostPortal || current$$1.stateNode.containerInfo !== portal.containerInfo || current$$1.stateNode.implementation !== portal.implementation) {
|
4856 |
|
4857 | var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
|
4858 | created.return = returnFiber;
|
4859 | return created;
|
4860 | } else {
|
4861 |
|
4862 | var existing = useFiber(current$$1, portal.children || [], expirationTime);
|
4863 | existing.return = returnFiber;
|
4864 | return existing;
|
4865 | }
|
4866 | }
|
4867 |
|
4868 | function updateFragment(returnFiber, current$$1, fragment, expirationTime, key) {
|
4869 | if (current$$1 === null || current$$1.tag !== Fragment) {
|
4870 |
|
4871 | var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
|
4872 | created.return = returnFiber;
|
4873 | return created;
|
4874 | } else {
|
4875 |
|
4876 | var existing = useFiber(current$$1, fragment, expirationTime);
|
4877 | existing.return = returnFiber;
|
4878 | return existing;
|
4879 | }
|
4880 | }
|
4881 |
|
4882 | function createChild(returnFiber, newChild, expirationTime) {
|
4883 | if (typeof newChild === 'string' || typeof newChild === 'number') {
|
4884 |
|
4885 |
|
4886 |
|
4887 | var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
|
4888 | created.return = returnFiber;
|
4889 | return created;
|
4890 | }
|
4891 |
|
4892 | if (typeof newChild === 'object' && newChild !== null) {
|
4893 | switch (newChild.$$typeof) {
|
4894 | case REACT_ELEMENT_TYPE:
|
4895 | {
|
4896 | var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
|
4897 | _created.ref = coerceRef(returnFiber, null, newChild);
|
4898 | _created.return = returnFiber;
|
4899 | return _created;
|
4900 | }
|
4901 | case REACT_PORTAL_TYPE:
|
4902 | {
|
4903 | var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
|
4904 | _created2.return = returnFiber;
|
4905 | return _created2;
|
4906 | }
|
4907 | }
|
4908 |
|
4909 | if (isArray(newChild) || getIteratorFn(newChild)) {
|
4910 | var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
|
4911 | _created3.return = returnFiber;
|
4912 | return _created3;
|
4913 | }
|
4914 |
|
4915 | throwOnInvalidObjectType(returnFiber, newChild);
|
4916 | }
|
4917 |
|
4918 | {
|
4919 | if (typeof newChild === 'function') {
|
4920 | warnOnFunctionType();
|
4921 | }
|
4922 | }
|
4923 |
|
4924 | return null;
|
4925 | }
|
4926 |
|
4927 | function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
|
4928 |
|
4929 |
|
4930 | var key = oldFiber !== null ? oldFiber.key : null;
|
4931 |
|
4932 | if (typeof newChild === 'string' || typeof newChild === 'number') {
|
4933 |
|
4934 |
|
4935 |
|
4936 | if (key !== null) {
|
4937 | return null;
|
4938 | }
|
4939 | return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
|
4940 | }
|
4941 |
|
4942 | if (typeof newChild === 'object' && newChild !== null) {
|
4943 | switch (newChild.$$typeof) {
|
4944 | case REACT_ELEMENT_TYPE:
|
4945 | {
|
4946 | if (newChild.key === key) {
|
4947 | if (newChild.type === REACT_FRAGMENT_TYPE) {
|
4948 | return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
|
4949 | }
|
4950 | return updateElement(returnFiber, oldFiber, newChild, expirationTime);
|
4951 | } else {
|
4952 | return null;
|
4953 | }
|
4954 | }
|
4955 | case REACT_PORTAL_TYPE:
|
4956 | {
|
4957 | if (newChild.key === key) {
|
4958 | return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
|
4959 | } else {
|
4960 | return null;
|
4961 | }
|
4962 | }
|
4963 | }
|
4964 |
|
4965 | if (isArray(newChild) || getIteratorFn(newChild)) {
|
4966 | if (key !== null) {
|
4967 | return null;
|
4968 | }
|
4969 |
|
4970 | return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
|
4971 | }
|
4972 |
|
4973 | throwOnInvalidObjectType(returnFiber, newChild);
|
4974 | }
|
4975 |
|
4976 | {
|
4977 | if (typeof newChild === 'function') {
|
4978 | warnOnFunctionType();
|
4979 | }
|
4980 | }
|
4981 |
|
4982 | return null;
|
4983 | }
|
4984 |
|
4985 | function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
|
4986 | if (typeof newChild === 'string' || typeof newChild === 'number') {
|
4987 |
|
4988 |
|
4989 | var matchedFiber = existingChildren.get(newIdx) || null;
|
4990 | return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
|
4991 | }
|
4992 |
|
4993 | if (typeof newChild === 'object' && newChild !== null) {
|
4994 | switch (newChild.$$typeof) {
|
4995 | case REACT_ELEMENT_TYPE:
|
4996 | {
|
4997 | var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
|
4998 | if (newChild.type === REACT_FRAGMENT_TYPE) {
|
4999 | return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
|
5000 | }
|
5001 | return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
|
5002 | }
|
5003 | case REACT_PORTAL_TYPE:
|
5004 | {
|
5005 | var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
|
5006 | return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
|
5007 | }
|
5008 | }
|
5009 |
|
5010 | if (isArray(newChild) || getIteratorFn(newChild)) {
|
5011 | var _matchedFiber3 = existingChildren.get(newIdx) || null;
|
5012 | return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
|
5013 | }
|
5014 |
|
5015 | throwOnInvalidObjectType(returnFiber, newChild);
|
5016 | }
|
5017 |
|
5018 | {
|
5019 | if (typeof newChild === 'function') {
|
5020 | warnOnFunctionType();
|
5021 | }
|
5022 | }
|
5023 |
|
5024 | return null;
|
5025 | }
|
5026 |
|
5027 | |
5028 |
|
5029 |
|
5030 | function warnOnInvalidKey(child, knownKeys) {
|
5031 | {
|
5032 | if (typeof child !== 'object' || child === null) {
|
5033 | return knownKeys;
|
5034 | }
|
5035 | switch (child.$$typeof) {
|
5036 | case REACT_ELEMENT_TYPE:
|
5037 | case REACT_PORTAL_TYPE:
|
5038 | warnForMissingKey(child);
|
5039 | var key = child.key;
|
5040 | if (typeof key !== 'string') {
|
5041 | break;
|
5042 | }
|
5043 | if (knownKeys === null) {
|
5044 | knownKeys = new Set();
|
5045 | knownKeys.add(key);
|
5046 | break;
|
5047 | }
|
5048 | if (!knownKeys.has(key)) {
|
5049 | knownKeys.add(key);
|
5050 | break;
|
5051 | }
|
5052 | warning$1(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key);
|
5053 | break;
|
5054 | default:
|
5055 | break;
|
5056 | }
|
5057 | }
|
5058 | return knownKeys;
|
5059 | }
|
5060 |
|
5061 | function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
|
5062 |
|
5063 |
|
5064 |
|
5065 |
|
5066 |
|
5067 |
|
5068 |
|
5069 |
|
5070 |
|
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 |
|
5081 | {
|
5082 |
|
5083 | var knownKeys = null;
|
5084 | for (var i = 0; i < newChildren.length; i++) {
|
5085 | var child = newChildren[i];
|
5086 | knownKeys = warnOnInvalidKey(child, knownKeys);
|
5087 | }
|
5088 | }
|
5089 |
|
5090 | var resultingFirstChild = null;
|
5091 | var previousNewFiber = null;
|
5092 |
|
5093 | var oldFiber = currentFirstChild;
|
5094 | var lastPlacedIndex = 0;
|
5095 | var newIdx = 0;
|
5096 | var nextOldFiber = null;
|
5097 | for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
|
5098 | if (oldFiber.index > newIdx) {
|
5099 | nextOldFiber = oldFiber;
|
5100 | oldFiber = null;
|
5101 | } else {
|
5102 | nextOldFiber = oldFiber.sibling;
|
5103 | }
|
5104 | var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
|
5105 | if (newFiber === null) {
|
5106 |
|
5107 |
|
5108 |
|
5109 |
|
5110 | if (oldFiber === null) {
|
5111 | oldFiber = nextOldFiber;
|
5112 | }
|
5113 | break;
|
5114 | }
|
5115 | if (shouldTrackSideEffects) {
|
5116 | if (oldFiber && newFiber.alternate === null) {
|
5117 |
|
5118 |
|
5119 | deleteChild(returnFiber, oldFiber);
|
5120 | }
|
5121 | }
|
5122 | lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
|
5123 | if (previousNewFiber === null) {
|
5124 |
|
5125 | resultingFirstChild = newFiber;
|
5126 | } else {
|
5127 |
|
5128 |
|
5129 |
|
5130 |
|
5131 | previousNewFiber.sibling = newFiber;
|
5132 | }
|
5133 | previousNewFiber = newFiber;
|
5134 | oldFiber = nextOldFiber;
|
5135 | }
|
5136 |
|
5137 | if (newIdx === newChildren.length) {
|
5138 |
|
5139 | deleteRemainingChildren(returnFiber, oldFiber);
|
5140 | return resultingFirstChild;
|
5141 | }
|
5142 |
|
5143 | if (oldFiber === null) {
|
5144 |
|
5145 |
|
5146 | for (; newIdx < newChildren.length; newIdx++) {
|
5147 | var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
|
5148 | if (_newFiber === null) {
|
5149 | continue;
|
5150 | }
|
5151 | lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
|
5152 | if (previousNewFiber === null) {
|
5153 |
|
5154 | resultingFirstChild = _newFiber;
|
5155 | } else {
|
5156 | previousNewFiber.sibling = _newFiber;
|
5157 | }
|
5158 | previousNewFiber = _newFiber;
|
5159 | }
|
5160 | return resultingFirstChild;
|
5161 | }
|
5162 |
|
5163 |
|
5164 | var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
|
5165 |
|
5166 |
|
5167 | for (; newIdx < newChildren.length; newIdx++) {
|
5168 | var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
|
5169 | if (_newFiber2 !== null) {
|
5170 | if (shouldTrackSideEffects) {
|
5171 | if (_newFiber2.alternate !== null) {
|
5172 |
|
5173 |
|
5174 |
|
5175 |
|
5176 | existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
|
5177 | }
|
5178 | }
|
5179 | lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
|
5180 | if (previousNewFiber === null) {
|
5181 | resultingFirstChild = _newFiber2;
|
5182 | } else {
|
5183 | previousNewFiber.sibling = _newFiber2;
|
5184 | }
|
5185 | previousNewFiber = _newFiber2;
|
5186 | }
|
5187 | }
|
5188 |
|
5189 | if (shouldTrackSideEffects) {
|
5190 |
|
5191 |
|
5192 | existingChildren.forEach(function (child) {
|
5193 | return deleteChild(returnFiber, child);
|
5194 | });
|
5195 | }
|
5196 |
|
5197 | return resultingFirstChild;
|
5198 | }
|
5199 |
|
5200 | function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
|
5201 |
|
5202 |
|
5203 |
|
5204 | var iteratorFn = getIteratorFn(newChildrenIterable);
|
5205 | (function () {
|
5206 | if (!(typeof iteratorFn === 'function')) {
|
5207 | {
|
5208 | throw ReactError(Error('An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.'));
|
5209 | }
|
5210 | }
|
5211 | })();
|
5212 |
|
5213 | {
|
5214 |
|
5215 |
|
5216 | if (typeof Symbol === 'function' &&
|
5217 |
|
5218 | newChildrenIterable[Symbol.toStringTag] === 'Generator') {
|
5219 | !didWarnAboutGenerators ? warning$1(false, 'Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.') : void 0;
|
5220 | didWarnAboutGenerators = true;
|
5221 | }
|
5222 |
|
5223 |
|
5224 | if (newChildrenIterable.entries === iteratorFn) {
|
5225 | !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
|
5226 | didWarnAboutMaps = true;
|
5227 | }
|
5228 |
|
5229 |
|
5230 |
|
5231 | var _newChildren = iteratorFn.call(newChildrenIterable);
|
5232 | if (_newChildren) {
|
5233 | var knownKeys = null;
|
5234 | var _step = _newChildren.next();
|
5235 | for (; !_step.done; _step = _newChildren.next()) {
|
5236 | var child = _step.value;
|
5237 | knownKeys = warnOnInvalidKey(child, knownKeys);
|
5238 | }
|
5239 | }
|
5240 | }
|
5241 |
|
5242 | var newChildren = iteratorFn.call(newChildrenIterable);
|
5243 | (function () {
|
5244 | if (!(newChildren != null)) {
|
5245 | {
|
5246 | throw ReactError(Error('An iterable object provided no iterator.'));
|
5247 | }
|
5248 | }
|
5249 | })();
|
5250 |
|
5251 | var resultingFirstChild = null;
|
5252 | var previousNewFiber = null;
|
5253 |
|
5254 | var oldFiber = currentFirstChild;
|
5255 | var lastPlacedIndex = 0;
|
5256 | var newIdx = 0;
|
5257 | var nextOldFiber = null;
|
5258 |
|
5259 | var step = newChildren.next();
|
5260 | for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
|
5261 | if (oldFiber.index > newIdx) {
|
5262 | nextOldFiber = oldFiber;
|
5263 | oldFiber = null;
|
5264 | } else {
|
5265 | nextOldFiber = oldFiber.sibling;
|
5266 | }
|
5267 | var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
|
5268 | if (newFiber === null) {
|
5269 |
|
5270 |
|
5271 |
|
5272 |
|
5273 | if (oldFiber === null) {
|
5274 | oldFiber = nextOldFiber;
|
5275 | }
|
5276 | break;
|
5277 | }
|
5278 | if (shouldTrackSideEffects) {
|
5279 | if (oldFiber && newFiber.alternate === null) {
|
5280 |
|
5281 |
|
5282 | deleteChild(returnFiber, oldFiber);
|
5283 | }
|
5284 | }
|
5285 | lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
|
5286 | if (previousNewFiber === null) {
|
5287 |
|
5288 | resultingFirstChild = newFiber;
|
5289 | } else {
|
5290 |
|
5291 |
|
5292 |
|
5293 |
|
5294 | previousNewFiber.sibling = newFiber;
|
5295 | }
|
5296 | previousNewFiber = newFiber;
|
5297 | oldFiber = nextOldFiber;
|
5298 | }
|
5299 |
|
5300 | if (step.done) {
|
5301 |
|
5302 | deleteRemainingChildren(returnFiber, oldFiber);
|
5303 | return resultingFirstChild;
|
5304 | }
|
5305 |
|
5306 | if (oldFiber === null) {
|
5307 |
|
5308 |
|
5309 | for (; !step.done; newIdx++, step = newChildren.next()) {
|
5310 | var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
|
5311 | if (_newFiber3 === null) {
|
5312 | continue;
|
5313 | }
|
5314 | lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
|
5315 | if (previousNewFiber === null) {
|
5316 |
|
5317 | resultingFirstChild = _newFiber3;
|
5318 | } else {
|
5319 | previousNewFiber.sibling = _newFiber3;
|
5320 | }
|
5321 | previousNewFiber = _newFiber3;
|
5322 | }
|
5323 | return resultingFirstChild;
|
5324 | }
|
5325 |
|
5326 |
|
5327 | var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
|
5328 |
|
5329 |
|
5330 | for (; !step.done; newIdx++, step = newChildren.next()) {
|
5331 | var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
|
5332 | if (_newFiber4 !== null) {
|
5333 | if (shouldTrackSideEffects) {
|
5334 | if (_newFiber4.alternate !== null) {
|
5335 |
|
5336 |
|
5337 |
|
5338 |
|
5339 | existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
|
5340 | }
|
5341 | }
|
5342 | lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
|
5343 | if (previousNewFiber === null) {
|
5344 | resultingFirstChild = _newFiber4;
|
5345 | } else {
|
5346 | previousNewFiber.sibling = _newFiber4;
|
5347 | }
|
5348 | previousNewFiber = _newFiber4;
|
5349 | }
|
5350 | }
|
5351 |
|
5352 | if (shouldTrackSideEffects) {
|
5353 |
|
5354 |
|
5355 | existingChildren.forEach(function (child) {
|
5356 | return deleteChild(returnFiber, child);
|
5357 | });
|
5358 | }
|
5359 |
|
5360 | return resultingFirstChild;
|
5361 | }
|
5362 |
|
5363 | function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
|
5364 |
|
5365 |
|
5366 | if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
|
5367 |
|
5368 |
|
5369 | deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
|
5370 | var existing = useFiber(currentFirstChild, textContent, expirationTime);
|
5371 | existing.return = returnFiber;
|
5372 | return existing;
|
5373 | }
|
5374 |
|
5375 |
|
5376 | deleteRemainingChildren(returnFiber, currentFirstChild);
|
5377 | var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
|
5378 | created.return = returnFiber;
|
5379 | return created;
|
5380 | }
|
5381 |
|
5382 | function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
|
5383 | var key = element.key;
|
5384 | var child = currentFirstChild;
|
5385 | while (child !== null) {
|
5386 |
|
5387 |
|
5388 | if (child.key === key) {
|
5389 | if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type || (
|
5390 |
|
5391 | isCompatibleFamilyForHotReloading(child, element))) {
|
5392 | deleteRemainingChildren(returnFiber, child.sibling);
|
5393 | var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
|
5394 | existing.ref = coerceRef(returnFiber, child, element);
|
5395 | existing.return = returnFiber;
|
5396 | {
|
5397 | existing._debugSource = element._source;
|
5398 | existing._debugOwner = element._owner;
|
5399 | }
|
5400 | return existing;
|
5401 | } else {
|
5402 | deleteRemainingChildren(returnFiber, child);
|
5403 | break;
|
5404 | }
|
5405 | } else {
|
5406 | deleteChild(returnFiber, child);
|
5407 | }
|
5408 | child = child.sibling;
|
5409 | }
|
5410 |
|
5411 | if (element.type === REACT_FRAGMENT_TYPE) {
|
5412 | var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
|
5413 | created.return = returnFiber;
|
5414 | return created;
|
5415 | } else {
|
5416 | var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
|
5417 | _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
|
5418 | _created4.return = returnFiber;
|
5419 | return _created4;
|
5420 | }
|
5421 | }
|
5422 |
|
5423 | function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
|
5424 | var key = portal.key;
|
5425 | var child = currentFirstChild;
|
5426 | while (child !== null) {
|
5427 |
|
5428 |
|
5429 | if (child.key === key) {
|
5430 | if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
|
5431 | deleteRemainingChildren(returnFiber, child.sibling);
|
5432 | var existing = useFiber(child, portal.children || [], expirationTime);
|
5433 | existing.return = returnFiber;
|
5434 | return existing;
|
5435 | } else {
|
5436 | deleteRemainingChildren(returnFiber, child);
|
5437 | break;
|
5438 | }
|
5439 | } else {
|
5440 | deleteChild(returnFiber, child);
|
5441 | }
|
5442 | child = child.sibling;
|
5443 | }
|
5444 |
|
5445 | var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
|
5446 | created.return = returnFiber;
|
5447 | return created;
|
5448 | }
|
5449 |
|
5450 |
|
5451 |
|
5452 |
|
5453 | function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
|
5454 |
|
5455 |
|
5456 |
|
5457 |
|
5458 |
|
5459 |
|
5460 |
|
5461 |
|
5462 | var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
|
5463 | if (isUnkeyedTopLevelFragment) {
|
5464 | newChild = newChild.props.children;
|
5465 | }
|
5466 |
|
5467 |
|
5468 | var isObject = typeof newChild === 'object' && newChild !== null;
|
5469 |
|
5470 | if (isObject) {
|
5471 | switch (newChild.$$typeof) {
|
5472 | case REACT_ELEMENT_TYPE:
|
5473 | return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
|
5474 | case REACT_PORTAL_TYPE:
|
5475 | return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
|
5476 | }
|
5477 | }
|
5478 |
|
5479 | if (typeof newChild === 'string' || typeof newChild === 'number') {
|
5480 | return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
|
5481 | }
|
5482 |
|
5483 | if (isArray(newChild)) {
|
5484 | return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
|
5485 | }
|
5486 |
|
5487 | if (getIteratorFn(newChild)) {
|
5488 | return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
|
5489 | }
|
5490 |
|
5491 | if (isObject) {
|
5492 | throwOnInvalidObjectType(returnFiber, newChild);
|
5493 | }
|
5494 |
|
5495 | {
|
5496 | if (typeof newChild === 'function') {
|
5497 | warnOnFunctionType();
|
5498 | }
|
5499 | }
|
5500 | if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
|
5501 |
|
5502 |
|
5503 |
|
5504 | switch (returnFiber.tag) {
|
5505 | case ClassComponent:
|
5506 | {
|
5507 | {
|
5508 | var instance = returnFiber.stateNode;
|
5509 | if (instance.render._isMockFunction) {
|
5510 |
|
5511 | break;
|
5512 | }
|
5513 | }
|
5514 | }
|
5515 |
|
5516 |
|
5517 |
|
5518 | case FunctionComponent:
|
5519 | {
|
5520 | var Component = returnFiber.type;
|
5521 | (function () {
|
5522 | {
|
5523 | {
|
5524 | throw ReactError(Error((Component.displayName || Component.name || 'Component') + '(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.'));
|
5525 | }
|
5526 | }
|
5527 | })();
|
5528 | }
|
5529 | }
|
5530 | }
|
5531 |
|
5532 |
|
5533 | return deleteRemainingChildren(returnFiber, currentFirstChild);
|
5534 | }
|
5535 |
|
5536 | return reconcileChildFibers;
|
5537 | }
|
5538 |
|
5539 | var reconcileChildFibers = ChildReconciler(true);
|
5540 | var mountChildFibers = ChildReconciler(false);
|
5541 |
|
5542 | function cloneChildFibers(current$$1, workInProgress) {
|
5543 | (function () {
|
5544 | if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
|
5545 | {
|
5546 | throw ReactError(Error('Resuming work not yet implemented.'));
|
5547 | }
|
5548 | }
|
5549 | })();
|
5550 |
|
5551 | if (workInProgress.child === null) {
|
5552 | return;
|
5553 | }
|
5554 |
|
5555 | var currentChild = workInProgress.child;
|
5556 | var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
|
5557 | workInProgress.child = newChild;
|
5558 |
|
5559 | newChild.return = workInProgress;
|
5560 | while (currentChild.sibling !== null) {
|
5561 | currentChild = currentChild.sibling;
|
5562 | newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
|
5563 | newChild.return = workInProgress;
|
5564 | }
|
5565 | newChild.sibling = null;
|
5566 | }
|
5567 |
|
5568 |
|
5569 | function resetChildFibers(workInProgress, renderExpirationTime) {
|
5570 | var child = workInProgress.child;
|
5571 | while (child !== null) {
|
5572 | resetWorkInProgress(child, renderExpirationTime);
|
5573 | child = child.sibling;
|
5574 | }
|
5575 | }
|
5576 |
|
5577 | var NO_CONTEXT$1 = {};
|
5578 |
|
5579 | var contextStackCursor$1 = createCursor(NO_CONTEXT$1);
|
5580 | var contextFiberStackCursor = createCursor(NO_CONTEXT$1);
|
5581 | var rootInstanceStackCursor = createCursor(NO_CONTEXT$1);
|
5582 |
|
5583 | function requiredContext(c) {
|
5584 | (function () {
|
5585 | if (!(c !== NO_CONTEXT$1)) {
|
5586 | {
|
5587 | throw ReactError(Error('Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.'));
|
5588 | }
|
5589 | }
|
5590 | })();
|
5591 | return c;
|
5592 | }
|
5593 |
|
5594 | function getRootHostContainer() {
|
5595 | var rootInstance = requiredContext(rootInstanceStackCursor.current);
|
5596 | return rootInstance;
|
5597 | }
|
5598 |
|
5599 | function pushHostContainer(fiber, nextRootInstance) {
|
5600 |
|
5601 |
|
5602 | push(rootInstanceStackCursor, nextRootInstance, fiber);
|
5603 |
|
5604 |
|
5605 | push(contextFiberStackCursor, fiber, fiber);
|
5606 |
|
5607 |
|
5608 |
|
5609 |
|
5610 |
|
5611 |
|
5612 | push(contextStackCursor$1, NO_CONTEXT$1, fiber);
|
5613 | var nextRootContext = getRootHostContext(nextRootInstance);
|
5614 |
|
5615 | pop(contextStackCursor$1, fiber);
|
5616 | push(contextStackCursor$1, nextRootContext, fiber);
|
5617 | }
|
5618 |
|
5619 | function popHostContainer(fiber) {
|
5620 | pop(contextStackCursor$1, fiber);
|
5621 | pop(contextFiberStackCursor, fiber);
|
5622 | pop(rootInstanceStackCursor, fiber);
|
5623 | }
|
5624 |
|
5625 | function getHostContext() {
|
5626 | var context = requiredContext(contextStackCursor$1.current);
|
5627 | return context;
|
5628 | }
|
5629 |
|
5630 | function pushHostContext(fiber) {
|
5631 | var rootInstance = requiredContext(rootInstanceStackCursor.current);
|
5632 | var context = requiredContext(contextStackCursor$1.current);
|
5633 | var nextContext = getChildHostContext(context, fiber.type, rootInstance);
|
5634 |
|
5635 |
|
5636 | if (context === nextContext) {
|
5637 | return;
|
5638 | }
|
5639 |
|
5640 |
|
5641 |
|
5642 | push(contextFiberStackCursor, fiber, fiber);
|
5643 | push(contextStackCursor$1, nextContext, fiber);
|
5644 | }
|
5645 |
|
5646 | function popHostContext(fiber) {
|
5647 |
|
5648 |
|
5649 | if (contextFiberStackCursor.current !== fiber) {
|
5650 | return;
|
5651 | }
|
5652 |
|
5653 | pop(contextStackCursor$1, fiber);
|
5654 | pop(contextFiberStackCursor, fiber);
|
5655 | }
|
5656 |
|
5657 | var DefaultSuspenseContext = 0;
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 | var SubtreeSuspenseContextMask = 1;
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 |
|
5673 | var InvisibleParentSuspenseContext = 1;
|
5674 |
|
5675 |
|
5676 |
|
5677 |
|
5678 |
|
5679 | var ForceSuspenseFallback = 2;
|
5680 |
|
5681 | var suspenseStackCursor = createCursor(DefaultSuspenseContext);
|
5682 |
|
5683 | function hasSuspenseContext(parentContext, flag) {
|
5684 | return (parentContext & flag) !== 0;
|
5685 | }
|
5686 |
|
5687 | function setDefaultShallowSuspenseContext(parentContext) {
|
5688 | return parentContext & SubtreeSuspenseContextMask;
|
5689 | }
|
5690 |
|
5691 | function setShallowSuspenseContext(parentContext, shallowContext) {
|
5692 | return parentContext & SubtreeSuspenseContextMask | shallowContext;
|
5693 | }
|
5694 |
|
5695 | function addSubtreeSuspenseContext(parentContext, subtreeContext) {
|
5696 | return parentContext | subtreeContext;
|
5697 | }
|
5698 |
|
5699 | function pushSuspenseContext(fiber, newContext) {
|
5700 | push(suspenseStackCursor, newContext, fiber);
|
5701 | }
|
5702 |
|
5703 | function popSuspenseContext(fiber) {
|
5704 | pop(suspenseStackCursor, fiber);
|
5705 | }
|
5706 |
|
5707 |
|
5708 |
|
5709 |
|
5710 |
|
5711 | function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
|
5712 |
|
5713 | var nextState = workInProgress.memoizedState;
|
5714 | if (nextState !== null) {
|
5715 | return false;
|
5716 | }
|
5717 | var props = workInProgress.memoizedProps;
|
5718 |
|
5719 | if (props.fallback === undefined) {
|
5720 | return false;
|
5721 | }
|
5722 |
|
5723 | if (props.unstable_avoidThisFallback !== true) {
|
5724 | return true;
|
5725 | }
|
5726 |
|
5727 |
|
5728 | if (hasInvisibleParent) {
|
5729 | return false;
|
5730 | }
|
5731 |
|
5732 | return true;
|
5733 | }
|
5734 |
|
5735 | function findFirstSuspended(row) {
|
5736 | var node = row;
|
5737 | while (node !== null) {
|
5738 | if (node.tag === SuspenseComponent) {
|
5739 | var state = node.memoizedState;
|
5740 | if (state !== null) {
|
5741 | return node;
|
5742 | }
|
5743 | } else if (node.tag === SuspenseListComponent &&
|
5744 |
|
5745 |
|
5746 | node.memoizedProps.revealOrder !== undefined) {
|
5747 | var didSuspend = (node.effectTag & DidCapture) !== NoEffect;
|
5748 | if (didSuspend) {
|
5749 | return node;
|
5750 | }
|
5751 | } else if (node.child !== null) {
|
5752 | node.child.return = node;
|
5753 | node = node.child;
|
5754 | continue;
|
5755 | }
|
5756 | if (node === row) {
|
5757 | return null;
|
5758 | }
|
5759 | while (node.sibling === null) {
|
5760 | if (node.return === null || node.return === row) {
|
5761 | return null;
|
5762 | }
|
5763 | node = node.return;
|
5764 | }
|
5765 | node.sibling.return = node.return;
|
5766 | node = node.sibling;
|
5767 | }
|
5768 | return null;
|
5769 | }
|
5770 |
|
5771 | function createResponderListener(responder, props) {
|
5772 | var eventResponderListener = {
|
5773 | responder: responder,
|
5774 | props: props
|
5775 | };
|
5776 | {
|
5777 | Object.freeze(eventResponderListener);
|
5778 | }
|
5779 | return eventResponderListener;
|
5780 | }
|
5781 |
|
5782 |
|
5783 |
|
5784 |
|
5785 |
|
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 | function createResponderInstance(responder, responderProps, responderState, target, fiber) {
|
5791 | return {
|
5792 | fiber: fiber,
|
5793 | props: responderProps,
|
5794 | responder: responder,
|
5795 | rootEventTypes: null,
|
5796 | state: responderState,
|
5797 | target: target
|
5798 | };
|
5799 | }
|
5800 |
|
5801 | var NoEffect$1 = 0;
|
5802 | var UnmountSnapshot = 2;
|
5803 | var UnmountMutation = 4;
|
5804 | var MountMutation = 8;
|
5805 | var UnmountLayout = 16;
|
5806 | var MountLayout = 32;
|
5807 | var MountPassive = 64;
|
5808 | var UnmountPassive = 128;
|
5809 |
|
5810 | var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
5811 |
|
5812 |
|
5813 | var didWarnAboutMismatchedHooksForComponent = void 0;
|
5814 | {
|
5815 | didWarnAboutMismatchedHooksForComponent = new Set();
|
5816 | }
|
5817 |
|
5818 |
|
5819 | var renderExpirationTime$1 = NoWork;
|
5820 |
|
5821 |
|
5822 | var currentlyRenderingFiber$1 = null;
|
5823 |
|
5824 |
|
5825 |
|
5826 |
|
5827 |
|
5828 | var currentHook = null;
|
5829 | var nextCurrentHook = null;
|
5830 | var firstWorkInProgressHook = null;
|
5831 | var workInProgressHook = null;
|
5832 | var nextWorkInProgressHook = null;
|
5833 |
|
5834 | var remainingExpirationTime = NoWork;
|
5835 | var componentUpdateQueue = null;
|
5836 | var sideEffectTag = 0;
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 |
|
5842 |
|
5843 |
|
5844 |
|
5845 |
|
5846 |
|
5847 | var didScheduleRenderPhaseUpdate = false;
|
5848 |
|
5849 | var renderPhaseUpdates = null;
|
5850 |
|
5851 | var numberOfReRenders = 0;
|
5852 | var RE_RENDER_LIMIT = 25;
|
5853 |
|
5854 |
|
5855 | var currentHookNameInDev = null;
|
5856 |
|
5857 |
|
5858 |
|
5859 |
|
5860 | var hookTypesDev = null;
|
5861 | var hookTypesUpdateIndexDev = -1;
|
5862 |
|
5863 |
|
5864 |
|
5865 |
|
5866 | var ignorePreviousDependencies = false;
|
5867 |
|
5868 | function mountHookTypesDev() {
|
5869 | {
|
5870 | var hookName = currentHookNameInDev;
|
5871 |
|
5872 | if (hookTypesDev === null) {
|
5873 | hookTypesDev = [hookName];
|
5874 | } else {
|
5875 | hookTypesDev.push(hookName);
|
5876 | }
|
5877 | }
|
5878 | }
|
5879 |
|
5880 | function updateHookTypesDev() {
|
5881 | {
|
5882 | var hookName = currentHookNameInDev;
|
5883 |
|
5884 | if (hookTypesDev !== null) {
|
5885 | hookTypesUpdateIndexDev++;
|
5886 | if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
|
5887 | warnOnHookMismatchInDev(hookName);
|
5888 | }
|
5889 | }
|
5890 | }
|
5891 | }
|
5892 |
|
5893 | function checkDepsAreArrayDev(deps) {
|
5894 | {
|
5895 | if (deps !== undefined && deps !== null && !Array.isArray(deps)) {
|
5896 |
|
5897 |
|
5898 | warning$1(false, '%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps);
|
5899 | }
|
5900 | }
|
5901 | }
|
5902 |
|
5903 | function warnOnHookMismatchInDev(currentHookName) {
|
5904 | {
|
5905 | var componentName = getComponentName(currentlyRenderingFiber$1.type);
|
5906 | if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
|
5907 | didWarnAboutMismatchedHooksForComponent.add(componentName);
|
5908 |
|
5909 | if (hookTypesDev !== null) {
|
5910 | var table = '';
|
5911 |
|
5912 | var secondColumnStart = 30;
|
5913 |
|
5914 | for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
|
5915 | var oldHookName = hookTypesDev[i];
|
5916 | var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
|
5917 |
|
5918 | var row = i + 1 + '. ' + oldHookName;
|
5919 |
|
5920 |
|
5921 |
|
5922 | while (row.length < secondColumnStart) {
|
5923 | row += ' ';
|
5924 | }
|
5925 |
|
5926 | row += newHookName + '\n';
|
5927 |
|
5928 | table += row;
|
5929 | }
|
5930 |
|
5931 | warning$1(false, 'React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
|
5932 | }
|
5933 | }
|
5934 | }
|
5935 | }
|
5936 |
|
5937 | function throwInvalidHookError() {
|
5938 | (function () {
|
5939 | {
|
5940 | {
|
5941 | throw ReactError(Error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.'));
|
5942 | }
|
5943 | }
|
5944 | })();
|
5945 | }
|
5946 |
|
5947 | function areHookInputsEqual(nextDeps, prevDeps) {
|
5948 | {
|
5949 | if (ignorePreviousDependencies) {
|
5950 |
|
5951 | return false;
|
5952 | }
|
5953 | }
|
5954 |
|
5955 | if (prevDeps === null) {
|
5956 | {
|
5957 | warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
|
5958 | }
|
5959 | return false;
|
5960 | }
|
5961 |
|
5962 | {
|
5963 |
|
5964 |
|
5965 | if (nextDeps.length !== prevDeps.length) {
|
5966 | warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + prevDeps.join(', ') + ']', '[' + nextDeps.join(', ') + ']');
|
5967 | }
|
5968 | }
|
5969 | for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
|
5970 | if (is(nextDeps[i], prevDeps[i])) {
|
5971 | continue;
|
5972 | }
|
5973 | return false;
|
5974 | }
|
5975 | return true;
|
5976 | }
|
5977 |
|
5978 | function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
|
5979 | renderExpirationTime$1 = nextRenderExpirationTime;
|
5980 | currentlyRenderingFiber$1 = workInProgress;
|
5981 | nextCurrentHook = current !== null ? current.memoizedState : null;
|
5982 |
|
5983 | {
|
5984 | hookTypesDev = current !== null ? current._debugHookTypes : null;
|
5985 | hookTypesUpdateIndexDev = -1;
|
5986 |
|
5987 | ignorePreviousDependencies = current !== null && current.type !== workInProgress.type;
|
5988 | }
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 |
|
5998 |
|
5999 |
|
6000 |
|
6001 |
|
6002 |
|
6003 |
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 |
|
6009 | {
|
6010 | if (nextCurrentHook !== null) {
|
6011 | ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
6012 | } else if (hookTypesDev !== null) {
|
6013 |
|
6014 |
|
6015 |
|
6016 |
|
6017 |
|
6018 | ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
|
6019 | } else {
|
6020 | ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
|
6021 | }
|
6022 | }
|
6023 |
|
6024 | var children = Component(props, refOrContext);
|
6025 |
|
6026 | if (didScheduleRenderPhaseUpdate) {
|
6027 | do {
|
6028 | didScheduleRenderPhaseUpdate = false;
|
6029 | numberOfReRenders += 1;
|
6030 |
|
6031 |
|
6032 | nextCurrentHook = current !== null ? current.memoizedState : null;
|
6033 | nextWorkInProgressHook = firstWorkInProgressHook;
|
6034 |
|
6035 | currentHook = null;
|
6036 | workInProgressHook = null;
|
6037 | componentUpdateQueue = null;
|
6038 |
|
6039 | {
|
6040 |
|
6041 | hookTypesUpdateIndexDev = -1;
|
6042 | }
|
6043 |
|
6044 | ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
6045 |
|
6046 | children = Component(props, refOrContext);
|
6047 | } while (didScheduleRenderPhaseUpdate);
|
6048 |
|
6049 | renderPhaseUpdates = null;
|
6050 | numberOfReRenders = 0;
|
6051 | }
|
6052 |
|
6053 |
|
6054 |
|
6055 | ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
6056 |
|
6057 | var renderedWork = currentlyRenderingFiber$1;
|
6058 |
|
6059 | renderedWork.memoizedState = firstWorkInProgressHook;
|
6060 | renderedWork.expirationTime = remainingExpirationTime;
|
6061 | renderedWork.updateQueue = componentUpdateQueue;
|
6062 | renderedWork.effectTag |= sideEffectTag;
|
6063 |
|
6064 | {
|
6065 | renderedWork._debugHookTypes = hookTypesDev;
|
6066 | }
|
6067 |
|
6068 |
|
6069 |
|
6070 | var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
|
6071 |
|
6072 | renderExpirationTime$1 = NoWork;
|
6073 | currentlyRenderingFiber$1 = null;
|
6074 |
|
6075 | currentHook = null;
|
6076 | nextCurrentHook = null;
|
6077 | firstWorkInProgressHook = null;
|
6078 | workInProgressHook = null;
|
6079 | nextWorkInProgressHook = null;
|
6080 |
|
6081 | {
|
6082 | currentHookNameInDev = null;
|
6083 | hookTypesDev = null;
|
6084 | hookTypesUpdateIndexDev = -1;
|
6085 | }
|
6086 |
|
6087 | remainingExpirationTime = NoWork;
|
6088 | componentUpdateQueue = null;
|
6089 | sideEffectTag = 0;
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 |
|
6096 | (function () {
|
6097 | if (!!didRenderTooFewHooks) {
|
6098 | {
|
6099 | throw ReactError(Error('Rendered fewer hooks than expected. This may be caused by an accidental early return statement.'));
|
6100 | }
|
6101 | }
|
6102 | })();
|
6103 |
|
6104 | return children;
|
6105 | }
|
6106 |
|
6107 | function bailoutHooks(current, workInProgress, expirationTime) {
|
6108 | workInProgress.updateQueue = current.updateQueue;
|
6109 | workInProgress.effectTag &= ~(Passive | Update);
|
6110 | if (current.expirationTime <= expirationTime) {
|
6111 | current.expirationTime = NoWork;
|
6112 | }
|
6113 | }
|
6114 |
|
6115 | function resetHooks() {
|
6116 |
|
6117 |
|
6118 | ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
6119 |
|
6120 |
|
6121 |
|
6122 |
|
6123 | renderExpirationTime$1 = NoWork;
|
6124 | currentlyRenderingFiber$1 = null;
|
6125 |
|
6126 | currentHook = null;
|
6127 | nextCurrentHook = null;
|
6128 | firstWorkInProgressHook = null;
|
6129 | workInProgressHook = null;
|
6130 | nextWorkInProgressHook = null;
|
6131 |
|
6132 | {
|
6133 | hookTypesDev = null;
|
6134 | hookTypesUpdateIndexDev = -1;
|
6135 |
|
6136 | currentHookNameInDev = null;
|
6137 | }
|
6138 |
|
6139 | remainingExpirationTime = NoWork;
|
6140 | componentUpdateQueue = null;
|
6141 | sideEffectTag = 0;
|
6142 |
|
6143 | didScheduleRenderPhaseUpdate = false;
|
6144 | renderPhaseUpdates = null;
|
6145 | numberOfReRenders = 0;
|
6146 | }
|
6147 |
|
6148 | function mountWorkInProgressHook() {
|
6149 | var hook = {
|
6150 | memoizedState: null,
|
6151 |
|
6152 | baseState: null,
|
6153 | queue: null,
|
6154 | baseUpdate: null,
|
6155 |
|
6156 | next: null
|
6157 | };
|
6158 |
|
6159 | if (workInProgressHook === null) {
|
6160 |
|
6161 | firstWorkInProgressHook = workInProgressHook = hook;
|
6162 | } else {
|
6163 |
|
6164 | workInProgressHook = workInProgressHook.next = hook;
|
6165 | }
|
6166 | return workInProgressHook;
|
6167 | }
|
6168 |
|
6169 | function updateWorkInProgressHook() {
|
6170 |
|
6171 |
|
6172 |
|
6173 |
|
6174 |
|
6175 | if (nextWorkInProgressHook !== null) {
|
6176 |
|
6177 | workInProgressHook = nextWorkInProgressHook;
|
6178 | nextWorkInProgressHook = workInProgressHook.next;
|
6179 |
|
6180 | currentHook = nextCurrentHook;
|
6181 | nextCurrentHook = currentHook !== null ? currentHook.next : null;
|
6182 | } else {
|
6183 |
|
6184 | (function () {
|
6185 | if (!(nextCurrentHook !== null)) {
|
6186 | {
|
6187 | throw ReactError(Error('Rendered more hooks than during the previous render.'));
|
6188 | }
|
6189 | }
|
6190 | })();
|
6191 | currentHook = nextCurrentHook;
|
6192 |
|
6193 | var newHook = {
|
6194 | memoizedState: currentHook.memoizedState,
|
6195 |
|
6196 | baseState: currentHook.baseState,
|
6197 | queue: currentHook.queue,
|
6198 | baseUpdate: currentHook.baseUpdate,
|
6199 |
|
6200 | next: null
|
6201 | };
|
6202 |
|
6203 | if (workInProgressHook === null) {
|
6204 |
|
6205 | workInProgressHook = firstWorkInProgressHook = newHook;
|
6206 | } else {
|
6207 |
|
6208 | workInProgressHook = workInProgressHook.next = newHook;
|
6209 | }
|
6210 | nextCurrentHook = currentHook.next;
|
6211 | }
|
6212 | return workInProgressHook;
|
6213 | }
|
6214 |
|
6215 | function createFunctionComponentUpdateQueue() {
|
6216 | return {
|
6217 | lastEffect: null
|
6218 | };
|
6219 | }
|
6220 |
|
6221 | function basicStateReducer(state, action) {
|
6222 | return typeof action === 'function' ? action(state) : action;
|
6223 | }
|
6224 |
|
6225 | function mountReducer(reducer, initialArg, init) {
|
6226 | var hook = mountWorkInProgressHook();
|
6227 | var initialState = void 0;
|
6228 | if (init !== undefined) {
|
6229 | initialState = init(initialArg);
|
6230 | } else {
|
6231 | initialState = initialArg;
|
6232 | }
|
6233 | hook.memoizedState = hook.baseState = initialState;
|
6234 | var queue = hook.queue = {
|
6235 | last: null,
|
6236 | dispatch: null,
|
6237 | lastRenderedReducer: reducer,
|
6238 | lastRenderedState: initialState
|
6239 | };
|
6240 | var dispatch = queue.dispatch = dispatchAction.bind(null,
|
6241 |
|
6242 | currentlyRenderingFiber$1, queue);
|
6243 | return [hook.memoizedState, dispatch];
|
6244 | }
|
6245 |
|
6246 | function updateReducer(reducer, initialArg, init) {
|
6247 | var hook = updateWorkInProgressHook();
|
6248 | var queue = hook.queue;
|
6249 | (function () {
|
6250 | if (!(queue !== null)) {
|
6251 | {
|
6252 | throw ReactError(Error('Should have a queue. This is likely a bug in React. Please file an issue.'));
|
6253 | }
|
6254 | }
|
6255 | })();
|
6256 |
|
6257 | queue.lastRenderedReducer = reducer;
|
6258 |
|
6259 | if (numberOfReRenders > 0) {
|
6260 |
|
6261 | var _dispatch = queue.dispatch;
|
6262 | if (renderPhaseUpdates !== null) {
|
6263 |
|
6264 | var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
6265 | if (firstRenderPhaseUpdate !== undefined) {
|
6266 | renderPhaseUpdates.delete(queue);
|
6267 | var newState = hook.memoizedState;
|
6268 | var update = firstRenderPhaseUpdate;
|
6269 | do {
|
6270 |
|
6271 |
|
6272 |
|
6273 | var _action = update.action;
|
6274 | newState = reducer(newState, _action);
|
6275 | update = update.next;
|
6276 | } while (update !== null);
|
6277 |
|
6278 |
|
6279 |
|
6280 | if (!is(newState, hook.memoizedState)) {
|
6281 | markWorkInProgressReceivedUpdate();
|
6282 | }
|
6283 |
|
6284 | hook.memoizedState = newState;
|
6285 |
|
6286 |
|
6287 |
|
6288 |
|
6289 | if (hook.baseUpdate === queue.last) {
|
6290 | hook.baseState = newState;
|
6291 | }
|
6292 |
|
6293 | queue.lastRenderedState = newState;
|
6294 |
|
6295 | return [newState, _dispatch];
|
6296 | }
|
6297 | }
|
6298 | return [hook.memoizedState, _dispatch];
|
6299 | }
|
6300 |
|
6301 |
|
6302 | var last = queue.last;
|
6303 |
|
6304 | var baseUpdate = hook.baseUpdate;
|
6305 | var baseState = hook.baseState;
|
6306 |
|
6307 |
|
6308 | var first = void 0;
|
6309 | if (baseUpdate !== null) {
|
6310 | if (last !== null) {
|
6311 |
|
6312 |
|
6313 |
|
6314 | last.next = null;
|
6315 | }
|
6316 | first = baseUpdate.next;
|
6317 | } else {
|
6318 | first = last !== null ? last.next : null;
|
6319 | }
|
6320 | if (first !== null) {
|
6321 | var _newState = baseState;
|
6322 | var newBaseState = null;
|
6323 | var newBaseUpdate = null;
|
6324 | var prevUpdate = baseUpdate;
|
6325 | var _update = first;
|
6326 | var didSkip = false;
|
6327 | do {
|
6328 | var updateExpirationTime = _update.expirationTime;
|
6329 | if (updateExpirationTime < renderExpirationTime$1) {
|
6330 |
|
6331 |
|
6332 |
|
6333 | if (!didSkip) {
|
6334 | didSkip = true;
|
6335 | newBaseUpdate = prevUpdate;
|
6336 | newBaseState = _newState;
|
6337 | }
|
6338 |
|
6339 | if (updateExpirationTime > remainingExpirationTime) {
|
6340 | remainingExpirationTime = updateExpirationTime;
|
6341 | }
|
6342 | } else {
|
6343 |
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 |
|
6349 |
|
6350 |
|
6351 | markRenderEventTimeAndConfig(updateExpirationTime, _update.suspenseConfig);
|
6352 |
|
6353 |
|
6354 | if (_update.eagerReducer === reducer) {
|
6355 |
|
6356 |
|
6357 | _newState = _update.eagerState;
|
6358 | } else {
|
6359 | var _action2 = _update.action;
|
6360 | _newState = reducer(_newState, _action2);
|
6361 | }
|
6362 | }
|
6363 | prevUpdate = _update;
|
6364 | _update = _update.next;
|
6365 | } while (_update !== null && _update !== first);
|
6366 |
|
6367 | if (!didSkip) {
|
6368 | newBaseUpdate = prevUpdate;
|
6369 | newBaseState = _newState;
|
6370 | }
|
6371 |
|
6372 |
|
6373 |
|
6374 | if (!is(_newState, hook.memoizedState)) {
|
6375 | markWorkInProgressReceivedUpdate();
|
6376 | }
|
6377 |
|
6378 | hook.memoizedState = _newState;
|
6379 | hook.baseUpdate = newBaseUpdate;
|
6380 | hook.baseState = newBaseState;
|
6381 |
|
6382 | queue.lastRenderedState = _newState;
|
6383 | }
|
6384 |
|
6385 | var dispatch = queue.dispatch;
|
6386 | return [hook.memoizedState, dispatch];
|
6387 | }
|
6388 |
|
6389 | function mountState(initialState) {
|
6390 | var hook = mountWorkInProgressHook();
|
6391 | if (typeof initialState === 'function') {
|
6392 | initialState = initialState();
|
6393 | }
|
6394 | hook.memoizedState = hook.baseState = initialState;
|
6395 | var queue = hook.queue = {
|
6396 | last: null,
|
6397 | dispatch: null,
|
6398 | lastRenderedReducer: basicStateReducer,
|
6399 | lastRenderedState: initialState
|
6400 | };
|
6401 | var dispatch = queue.dispatch = dispatchAction.bind(null,
|
6402 |
|
6403 | currentlyRenderingFiber$1, queue);
|
6404 | return [hook.memoizedState, dispatch];
|
6405 | }
|
6406 |
|
6407 | function updateState(initialState) {
|
6408 | return updateReducer(basicStateReducer, initialState);
|
6409 | }
|
6410 |
|
6411 | function pushEffect(tag, create, destroy, deps) {
|
6412 | var effect = {
|
6413 | tag: tag,
|
6414 | create: create,
|
6415 | destroy: destroy,
|
6416 | deps: deps,
|
6417 |
|
6418 | next: null
|
6419 | };
|
6420 | if (componentUpdateQueue === null) {
|
6421 | componentUpdateQueue = createFunctionComponentUpdateQueue();
|
6422 | componentUpdateQueue.lastEffect = effect.next = effect;
|
6423 | } else {
|
6424 | var _lastEffect = componentUpdateQueue.lastEffect;
|
6425 | if (_lastEffect === null) {
|
6426 | componentUpdateQueue.lastEffect = effect.next = effect;
|
6427 | } else {
|
6428 | var firstEffect = _lastEffect.next;
|
6429 | _lastEffect.next = effect;
|
6430 | effect.next = firstEffect;
|
6431 | componentUpdateQueue.lastEffect = effect;
|
6432 | }
|
6433 | }
|
6434 | return effect;
|
6435 | }
|
6436 |
|
6437 | function mountRef(initialValue) {
|
6438 | var hook = mountWorkInProgressHook();
|
6439 | var ref = { current: initialValue };
|
6440 | {
|
6441 | Object.seal(ref);
|
6442 | }
|
6443 | hook.memoizedState = ref;
|
6444 | return ref;
|
6445 | }
|
6446 |
|
6447 | function updateRef(initialValue) {
|
6448 | var hook = updateWorkInProgressHook();
|
6449 | return hook.memoizedState;
|
6450 | }
|
6451 |
|
6452 | function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
|
6453 | var hook = mountWorkInProgressHook();
|
6454 | var nextDeps = deps === undefined ? null : deps;
|
6455 | sideEffectTag |= fiberEffectTag;
|
6456 | hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps);
|
6457 | }
|
6458 |
|
6459 | function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
|
6460 | var hook = updateWorkInProgressHook();
|
6461 | var nextDeps = deps === undefined ? null : deps;
|
6462 | var destroy = undefined;
|
6463 |
|
6464 | if (currentHook !== null) {
|
6465 | var prevEffect = currentHook.memoizedState;
|
6466 | destroy = prevEffect.destroy;
|
6467 | if (nextDeps !== null) {
|
6468 | var prevDeps = prevEffect.deps;
|
6469 | if (areHookInputsEqual(nextDeps, prevDeps)) {
|
6470 | pushEffect(NoEffect$1, create, destroy, nextDeps);
|
6471 | return;
|
6472 | }
|
6473 | }
|
6474 | }
|
6475 |
|
6476 | sideEffectTag |= fiberEffectTag;
|
6477 | hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps);
|
6478 | }
|
6479 |
|
6480 | function mountEffect(create, deps) {
|
6481 | {
|
6482 |
|
6483 | if ('undefined' !== typeof jest) {
|
6484 | warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
|
6485 | }
|
6486 | }
|
6487 | return mountEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
|
6488 | }
|
6489 |
|
6490 | function updateEffect(create, deps) {
|
6491 | {
|
6492 |
|
6493 | if ('undefined' !== typeof jest) {
|
6494 | warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
|
6495 | }
|
6496 | }
|
6497 | return updateEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
|
6498 | }
|
6499 |
|
6500 | function mountLayoutEffect(create, deps) {
|
6501 | return mountEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
|
6502 | }
|
6503 |
|
6504 | function updateLayoutEffect(create, deps) {
|
6505 | return updateEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
|
6506 | }
|
6507 |
|
6508 | function imperativeHandleEffect(create, ref) {
|
6509 | if (typeof ref === 'function') {
|
6510 | var refCallback = ref;
|
6511 | var _inst = create();
|
6512 | refCallback(_inst);
|
6513 | return function () {
|
6514 | refCallback(null);
|
6515 | };
|
6516 | } else if (ref !== null && ref !== undefined) {
|
6517 | var refObject = ref;
|
6518 | {
|
6519 | !refObject.hasOwnProperty('current') ? warning$1(false, 'Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}') : void 0;
|
6520 | }
|
6521 | var _inst2 = create();
|
6522 | refObject.current = _inst2;
|
6523 | return function () {
|
6524 | refObject.current = null;
|
6525 | };
|
6526 | }
|
6527 | }
|
6528 |
|
6529 | function mountImperativeHandle(ref, create, deps) {
|
6530 | {
|
6531 | !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
|
6532 | }
|
6533 |
|
6534 |
|
6535 | var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
6536 |
|
6537 | return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
6538 | }
|
6539 |
|
6540 | function updateImperativeHandle(ref, create, deps) {
|
6541 | {
|
6542 | !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
|
6543 | }
|
6544 |
|
6545 |
|
6546 | var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
|
6547 |
|
6548 | return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
6549 | }
|
6550 |
|
6551 | function mountDebugValue(value, formatterFn) {
|
6552 |
|
6553 |
|
6554 |
|
6555 | }
|
6556 |
|
6557 | var updateDebugValue = mountDebugValue;
|
6558 |
|
6559 | function mountCallback(callback, deps) {
|
6560 | var hook = mountWorkInProgressHook();
|
6561 | var nextDeps = deps === undefined ? null : deps;
|
6562 | hook.memoizedState = [callback, nextDeps];
|
6563 | return callback;
|
6564 | }
|
6565 |
|
6566 | function updateCallback(callback, deps) {
|
6567 | var hook = updateWorkInProgressHook();
|
6568 | var nextDeps = deps === undefined ? null : deps;
|
6569 | var prevState = hook.memoizedState;
|
6570 | if (prevState !== null) {
|
6571 | if (nextDeps !== null) {
|
6572 | var prevDeps = prevState[1];
|
6573 | if (areHookInputsEqual(nextDeps, prevDeps)) {
|
6574 | return prevState[0];
|
6575 | }
|
6576 | }
|
6577 | }
|
6578 | hook.memoizedState = [callback, nextDeps];
|
6579 | return callback;
|
6580 | }
|
6581 |
|
6582 | function mountMemo(nextCreate, deps) {
|
6583 | var hook = mountWorkInProgressHook();
|
6584 | var nextDeps = deps === undefined ? null : deps;
|
6585 | var nextValue = nextCreate();
|
6586 | hook.memoizedState = [nextValue, nextDeps];
|
6587 | return nextValue;
|
6588 | }
|
6589 |
|
6590 | function updateMemo(nextCreate, deps) {
|
6591 | var hook = updateWorkInProgressHook();
|
6592 | var nextDeps = deps === undefined ? null : deps;
|
6593 | var prevState = hook.memoizedState;
|
6594 | if (prevState !== null) {
|
6595 |
|
6596 | if (nextDeps !== null) {
|
6597 | var prevDeps = prevState[1];
|
6598 | if (areHookInputsEqual(nextDeps, prevDeps)) {
|
6599 | return prevState[0];
|
6600 | }
|
6601 | }
|
6602 | }
|
6603 | var nextValue = nextCreate();
|
6604 | hook.memoizedState = [nextValue, nextDeps];
|
6605 | return nextValue;
|
6606 | }
|
6607 |
|
6608 | function dispatchAction(fiber, queue, action) {
|
6609 | (function () {
|
6610 | if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
6611 | {
|
6612 | throw ReactError(Error('Too many re-renders. React limits the number of renders to prevent an infinite loop.'));
|
6613 | }
|
6614 | }
|
6615 | })();
|
6616 |
|
6617 | {
|
6618 | !(arguments.length <= 3) ? warning$1(false, "State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().') : void 0;
|
6619 | }
|
6620 |
|
6621 | var alternate = fiber.alternate;
|
6622 | if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
|
6623 |
|
6624 |
|
6625 |
|
6626 | didScheduleRenderPhaseUpdate = true;
|
6627 | var update = {
|
6628 | expirationTime: renderExpirationTime$1,
|
6629 | suspenseConfig: null,
|
6630 | action: action,
|
6631 | eagerReducer: null,
|
6632 | eagerState: null,
|
6633 | next: null
|
6634 | };
|
6635 | {
|
6636 | update.priority = getCurrentPriorityLevel();
|
6637 | }
|
6638 | if (renderPhaseUpdates === null) {
|
6639 | renderPhaseUpdates = new Map();
|
6640 | }
|
6641 | var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
6642 | if (firstRenderPhaseUpdate === undefined) {
|
6643 | renderPhaseUpdates.set(queue, update);
|
6644 | } else {
|
6645 |
|
6646 | var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
|
6647 | while (lastRenderPhaseUpdate.next !== null) {
|
6648 | lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
|
6649 | }
|
6650 | lastRenderPhaseUpdate.next = update;
|
6651 | }
|
6652 | } else {
|
6653 | if (revertPassiveEffectsChange) {
|
6654 | flushPassiveEffects();
|
6655 | }
|
6656 |
|
6657 | var currentTime = requestCurrentTime();
|
6658 | var _suspenseConfig = requestCurrentSuspenseConfig();
|
6659 | var _expirationTime = computeExpirationForFiber(currentTime, fiber, _suspenseConfig);
|
6660 |
|
6661 | var _update2 = {
|
6662 | expirationTime: _expirationTime,
|
6663 | suspenseConfig: _suspenseConfig,
|
6664 | action: action,
|
6665 | eagerReducer: null,
|
6666 | eagerState: null,
|
6667 | next: null
|
6668 | };
|
6669 |
|
6670 | {
|
6671 | _update2.priority = getCurrentPriorityLevel();
|
6672 | }
|
6673 |
|
6674 |
|
6675 | var _last = queue.last;
|
6676 | if (_last === null) {
|
6677 |
|
6678 | _update2.next = _update2;
|
6679 | } else {
|
6680 | var first = _last.next;
|
6681 | if (first !== null) {
|
6682 |
|
6683 | _update2.next = first;
|
6684 | }
|
6685 | _last.next = _update2;
|
6686 | }
|
6687 | queue.last = _update2;
|
6688 |
|
6689 | if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) {
|
6690 |
|
6691 |
|
6692 |
|
6693 | var _lastRenderedReducer = queue.lastRenderedReducer;
|
6694 | if (_lastRenderedReducer !== null) {
|
6695 | var prevDispatcher = void 0;
|
6696 | {
|
6697 | prevDispatcher = ReactCurrentDispatcher$1.current;
|
6698 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
6699 | }
|
6700 | try {
|
6701 | var currentState = queue.lastRenderedState;
|
6702 | var _eagerState = _lastRenderedReducer(currentState, action);
|
6703 |
|
6704 |
|
6705 |
|
6706 |
|
6707 | _update2.eagerReducer = _lastRenderedReducer;
|
6708 | _update2.eagerState = _eagerState;
|
6709 | if (is(_eagerState, currentState)) {
|
6710 |
|
6711 |
|
6712 |
|
6713 |
|
6714 | return;
|
6715 | }
|
6716 | } catch (error) {
|
6717 |
|
6718 | } finally {
|
6719 | {
|
6720 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6721 | }
|
6722 | }
|
6723 | }
|
6724 | }
|
6725 | {
|
6726 |
|
6727 | if ('undefined' !== typeof jest) {
|
6728 | warnIfNotScopedWithMatchingAct(fiber);
|
6729 | warnIfNotCurrentlyActingUpdatesInDev(fiber);
|
6730 | }
|
6731 | }
|
6732 | scheduleWork(fiber, _expirationTime);
|
6733 | }
|
6734 | }
|
6735 |
|
6736 | var ContextOnlyDispatcher = {
|
6737 | readContext: readContext,
|
6738 |
|
6739 | useCallback: throwInvalidHookError,
|
6740 | useContext: throwInvalidHookError,
|
6741 | useEffect: throwInvalidHookError,
|
6742 | useImperativeHandle: throwInvalidHookError,
|
6743 | useLayoutEffect: throwInvalidHookError,
|
6744 | useMemo: throwInvalidHookError,
|
6745 | useReducer: throwInvalidHookError,
|
6746 | useRef: throwInvalidHookError,
|
6747 | useState: throwInvalidHookError,
|
6748 | useDebugValue: throwInvalidHookError,
|
6749 | useResponder: throwInvalidHookError
|
6750 | };
|
6751 |
|
6752 | var HooksDispatcherOnMountInDEV = null;
|
6753 | var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
6754 | var HooksDispatcherOnUpdateInDEV = null;
|
6755 | var InvalidNestedHooksDispatcherOnMountInDEV = null;
|
6756 | var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
6757 |
|
6758 | {
|
6759 | var warnInvalidContextAccess = function () {
|
6760 | warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
|
6761 | };
|
6762 |
|
6763 | var warnInvalidHookAccess = function () {
|
6764 | warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks');
|
6765 | };
|
6766 |
|
6767 | HooksDispatcherOnMountInDEV = {
|
6768 | readContext: function (context, observedBits) {
|
6769 | return readContext(context, observedBits);
|
6770 | },
|
6771 | useCallback: function (callback, deps) {
|
6772 | currentHookNameInDev = 'useCallback';
|
6773 | mountHookTypesDev();
|
6774 | checkDepsAreArrayDev(deps);
|
6775 | return mountCallback(callback, deps);
|
6776 | },
|
6777 | useContext: function (context, observedBits) {
|
6778 | currentHookNameInDev = 'useContext';
|
6779 | mountHookTypesDev();
|
6780 | return readContext(context, observedBits);
|
6781 | },
|
6782 | useEffect: function (create, deps) {
|
6783 | currentHookNameInDev = 'useEffect';
|
6784 | mountHookTypesDev();
|
6785 | checkDepsAreArrayDev(deps);
|
6786 | return mountEffect(create, deps);
|
6787 | },
|
6788 | useImperativeHandle: function (ref, create, deps) {
|
6789 | currentHookNameInDev = 'useImperativeHandle';
|
6790 | mountHookTypesDev();
|
6791 | checkDepsAreArrayDev(deps);
|
6792 | return mountImperativeHandle(ref, create, deps);
|
6793 | },
|
6794 | useLayoutEffect: function (create, deps) {
|
6795 | currentHookNameInDev = 'useLayoutEffect';
|
6796 | mountHookTypesDev();
|
6797 | checkDepsAreArrayDev(deps);
|
6798 | return mountLayoutEffect(create, deps);
|
6799 | },
|
6800 | useMemo: function (create, deps) {
|
6801 | currentHookNameInDev = 'useMemo';
|
6802 | mountHookTypesDev();
|
6803 | checkDepsAreArrayDev(deps);
|
6804 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6805 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
6806 | try {
|
6807 | return mountMemo(create, deps);
|
6808 | } finally {
|
6809 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6810 | }
|
6811 | },
|
6812 | useReducer: function (reducer, initialArg, init) {
|
6813 | currentHookNameInDev = 'useReducer';
|
6814 | mountHookTypesDev();
|
6815 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6816 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
6817 | try {
|
6818 | return mountReducer(reducer, initialArg, init);
|
6819 | } finally {
|
6820 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6821 | }
|
6822 | },
|
6823 | useRef: function (initialValue) {
|
6824 | currentHookNameInDev = 'useRef';
|
6825 | mountHookTypesDev();
|
6826 | return mountRef(initialValue);
|
6827 | },
|
6828 | useState: function (initialState) {
|
6829 | currentHookNameInDev = 'useState';
|
6830 | mountHookTypesDev();
|
6831 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6832 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
6833 | try {
|
6834 | return mountState(initialState);
|
6835 | } finally {
|
6836 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6837 | }
|
6838 | },
|
6839 | useDebugValue: function (value, formatterFn) {
|
6840 | currentHookNameInDev = 'useDebugValue';
|
6841 | mountHookTypesDev();
|
6842 | return mountDebugValue(value, formatterFn);
|
6843 | },
|
6844 | useResponder: function (responder, props) {
|
6845 | currentHookNameInDev = 'useResponder';
|
6846 | mountHookTypesDev();
|
6847 | return createResponderListener(responder, props);
|
6848 | }
|
6849 | };
|
6850 |
|
6851 | HooksDispatcherOnMountWithHookTypesInDEV = {
|
6852 | readContext: function (context, observedBits) {
|
6853 | return readContext(context, observedBits);
|
6854 | },
|
6855 | useCallback: function (callback, deps) {
|
6856 | currentHookNameInDev = 'useCallback';
|
6857 | updateHookTypesDev();
|
6858 | return mountCallback(callback, deps);
|
6859 | },
|
6860 | useContext: function (context, observedBits) {
|
6861 | currentHookNameInDev = 'useContext';
|
6862 | updateHookTypesDev();
|
6863 | return readContext(context, observedBits);
|
6864 | },
|
6865 | useEffect: function (create, deps) {
|
6866 | currentHookNameInDev = 'useEffect';
|
6867 | updateHookTypesDev();
|
6868 | return mountEffect(create, deps);
|
6869 | },
|
6870 | useImperativeHandle: function (ref, create, deps) {
|
6871 | currentHookNameInDev = 'useImperativeHandle';
|
6872 | updateHookTypesDev();
|
6873 | return mountImperativeHandle(ref, create, deps);
|
6874 | },
|
6875 | useLayoutEffect: function (create, deps) {
|
6876 | currentHookNameInDev = 'useLayoutEffect';
|
6877 | updateHookTypesDev();
|
6878 | return mountLayoutEffect(create, deps);
|
6879 | },
|
6880 | useMemo: function (create, deps) {
|
6881 | currentHookNameInDev = 'useMemo';
|
6882 | updateHookTypesDev();
|
6883 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6884 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
6885 | try {
|
6886 | return mountMemo(create, deps);
|
6887 | } finally {
|
6888 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6889 | }
|
6890 | },
|
6891 | useReducer: function (reducer, initialArg, init) {
|
6892 | currentHookNameInDev = 'useReducer';
|
6893 | updateHookTypesDev();
|
6894 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6895 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
6896 | try {
|
6897 | return mountReducer(reducer, initialArg, init);
|
6898 | } finally {
|
6899 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6900 | }
|
6901 | },
|
6902 | useRef: function (initialValue) {
|
6903 | currentHookNameInDev = 'useRef';
|
6904 | updateHookTypesDev();
|
6905 | return mountRef(initialValue);
|
6906 | },
|
6907 | useState: function (initialState) {
|
6908 | currentHookNameInDev = 'useState';
|
6909 | updateHookTypesDev();
|
6910 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6911 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
6912 | try {
|
6913 | return mountState(initialState);
|
6914 | } finally {
|
6915 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6916 | }
|
6917 | },
|
6918 | useDebugValue: function (value, formatterFn) {
|
6919 | currentHookNameInDev = 'useDebugValue';
|
6920 | updateHookTypesDev();
|
6921 | return mountDebugValue(value, formatterFn);
|
6922 | },
|
6923 | useResponder: function (responder, props) {
|
6924 | currentHookNameInDev = 'useResponder';
|
6925 | updateHookTypesDev();
|
6926 | return createResponderListener(responder, props);
|
6927 | }
|
6928 | };
|
6929 |
|
6930 | HooksDispatcherOnUpdateInDEV = {
|
6931 | readContext: function (context, observedBits) {
|
6932 | return readContext(context, observedBits);
|
6933 | },
|
6934 | useCallback: function (callback, deps) {
|
6935 | currentHookNameInDev = 'useCallback';
|
6936 | updateHookTypesDev();
|
6937 | return updateCallback(callback, deps);
|
6938 | },
|
6939 | useContext: function (context, observedBits) {
|
6940 | currentHookNameInDev = 'useContext';
|
6941 | updateHookTypesDev();
|
6942 | return readContext(context, observedBits);
|
6943 | },
|
6944 | useEffect: function (create, deps) {
|
6945 | currentHookNameInDev = 'useEffect';
|
6946 | updateHookTypesDev();
|
6947 | return updateEffect(create, deps);
|
6948 | },
|
6949 | useImperativeHandle: function (ref, create, deps) {
|
6950 | currentHookNameInDev = 'useImperativeHandle';
|
6951 | updateHookTypesDev();
|
6952 | return updateImperativeHandle(ref, create, deps);
|
6953 | },
|
6954 | useLayoutEffect: function (create, deps) {
|
6955 | currentHookNameInDev = 'useLayoutEffect';
|
6956 | updateHookTypesDev();
|
6957 | return updateLayoutEffect(create, deps);
|
6958 | },
|
6959 | useMemo: function (create, deps) {
|
6960 | currentHookNameInDev = 'useMemo';
|
6961 | updateHookTypesDev();
|
6962 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6963 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
6964 | try {
|
6965 | return updateMemo(create, deps);
|
6966 | } finally {
|
6967 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6968 | }
|
6969 | },
|
6970 | useReducer: function (reducer, initialArg, init) {
|
6971 | currentHookNameInDev = 'useReducer';
|
6972 | updateHookTypesDev();
|
6973 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6974 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
6975 | try {
|
6976 | return updateReducer(reducer, initialArg, init);
|
6977 | } finally {
|
6978 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6979 | }
|
6980 | },
|
6981 | useRef: function (initialValue) {
|
6982 | currentHookNameInDev = 'useRef';
|
6983 | updateHookTypesDev();
|
6984 | return updateRef(initialValue);
|
6985 | },
|
6986 | useState: function (initialState) {
|
6987 | currentHookNameInDev = 'useState';
|
6988 | updateHookTypesDev();
|
6989 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6990 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
6991 | try {
|
6992 | return updateState(initialState);
|
6993 | } finally {
|
6994 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6995 | }
|
6996 | },
|
6997 | useDebugValue: function (value, formatterFn) {
|
6998 | currentHookNameInDev = 'useDebugValue';
|
6999 | updateHookTypesDev();
|
7000 | return updateDebugValue(value, formatterFn);
|
7001 | },
|
7002 | useResponder: function (responder, props) {
|
7003 | currentHookNameInDev = 'useResponder';
|
7004 | updateHookTypesDev();
|
7005 | return createResponderListener(responder, props);
|
7006 | }
|
7007 | };
|
7008 |
|
7009 | InvalidNestedHooksDispatcherOnMountInDEV = {
|
7010 | readContext: function (context, observedBits) {
|
7011 | warnInvalidContextAccess();
|
7012 | return readContext(context, observedBits);
|
7013 | },
|
7014 | useCallback: function (callback, deps) {
|
7015 | currentHookNameInDev = 'useCallback';
|
7016 | warnInvalidHookAccess();
|
7017 | mountHookTypesDev();
|
7018 | return mountCallback(callback, deps);
|
7019 | },
|
7020 | useContext: function (context, observedBits) {
|
7021 | currentHookNameInDev = 'useContext';
|
7022 | warnInvalidHookAccess();
|
7023 | mountHookTypesDev();
|
7024 | return readContext(context, observedBits);
|
7025 | },
|
7026 | useEffect: function (create, deps) {
|
7027 | currentHookNameInDev = 'useEffect';
|
7028 | warnInvalidHookAccess();
|
7029 | mountHookTypesDev();
|
7030 | return mountEffect(create, deps);
|
7031 | },
|
7032 | useImperativeHandle: function (ref, create, deps) {
|
7033 | currentHookNameInDev = 'useImperativeHandle';
|
7034 | warnInvalidHookAccess();
|
7035 | mountHookTypesDev();
|
7036 | return mountImperativeHandle(ref, create, deps);
|
7037 | },
|
7038 | useLayoutEffect: function (create, deps) {
|
7039 | currentHookNameInDev = 'useLayoutEffect';
|
7040 | warnInvalidHookAccess();
|
7041 | mountHookTypesDev();
|
7042 | return mountLayoutEffect(create, deps);
|
7043 | },
|
7044 | useMemo: function (create, deps) {
|
7045 | currentHookNameInDev = 'useMemo';
|
7046 | warnInvalidHookAccess();
|
7047 | mountHookTypesDev();
|
7048 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
7049 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
7050 | try {
|
7051 | return mountMemo(create, deps);
|
7052 | } finally {
|
7053 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
7054 | }
|
7055 | },
|
7056 | useReducer: function (reducer, initialArg, init) {
|
7057 | currentHookNameInDev = 'useReducer';
|
7058 | warnInvalidHookAccess();
|
7059 | mountHookTypesDev();
|
7060 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
7061 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
7062 | try {
|
7063 | return mountReducer(reducer, initialArg, init);
|
7064 | } finally {
|
7065 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
7066 | }
|
7067 | },
|
7068 | useRef: function (initialValue) {
|
7069 | currentHookNameInDev = 'useRef';
|
7070 | warnInvalidHookAccess();
|
7071 | mountHookTypesDev();
|
7072 | return mountRef(initialValue);
|
7073 | },
|
7074 | useState: function (initialState) {
|
7075 | currentHookNameInDev = 'useState';
|
7076 | warnInvalidHookAccess();
|
7077 | mountHookTypesDev();
|
7078 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
7079 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
7080 | try {
|
7081 | return mountState(initialState);
|
7082 | } finally {
|
7083 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
7084 | }
|
7085 | },
|
7086 | useDebugValue: function (value, formatterFn) {
|
7087 | currentHookNameInDev = 'useDebugValue';
|
7088 | warnInvalidHookAccess();
|
7089 | mountHookTypesDev();
|
7090 | return mountDebugValue(value, formatterFn);
|
7091 | },
|
7092 | useResponder: function (responder, props) {
|
7093 | currentHookNameInDev = 'useResponder';
|
7094 | warnInvalidHookAccess();
|
7095 | mountHookTypesDev();
|
7096 | return createResponderListener(responder, props);
|
7097 | }
|
7098 | };
|
7099 |
|
7100 | InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
7101 | readContext: function (context, observedBits) {
|
7102 | warnInvalidContextAccess();
|
7103 | return readContext(context, observedBits);
|
7104 | },
|
7105 | useCallback: function (callback, deps) {
|
7106 | currentHookNameInDev = 'useCallback';
|
7107 | warnInvalidHookAccess();
|
7108 | updateHookTypesDev();
|
7109 | return updateCallback(callback, deps);
|
7110 | },
|
7111 | useContext: function (context, observedBits) {
|
7112 | currentHookNameInDev = 'useContext';
|
7113 | warnInvalidHookAccess();
|
7114 | updateHookTypesDev();
|
7115 | return readContext(context, observedBits);
|
7116 | },
|
7117 | useEffect: function (create, deps) {
|
7118 | currentHookNameInDev = 'useEffect';
|
7119 | warnInvalidHookAccess();
|
7120 | updateHookTypesDev();
|
7121 | return updateEffect(create, deps);
|
7122 | },
|
7123 | useImperativeHandle: function (ref, create, deps) {
|
7124 | currentHookNameInDev = 'useImperativeHandle';
|
7125 | warnInvalidHookAccess();
|
7126 | updateHookTypesDev();
|
7127 | return updateImperativeHandle(ref, create, deps);
|
7128 | },
|
7129 | useLayoutEffect: function (create, deps) {
|
7130 | currentHookNameInDev = 'useLayoutEffect';
|
7131 | warnInvalidHookAccess();
|
7132 | updateHookTypesDev();
|
7133 | return updateLayoutEffect(create, deps);
|
7134 | },
|
7135 | useMemo: function (create, deps) {
|
7136 | currentHookNameInDev = 'useMemo';
|
7137 | warnInvalidHookAccess();
|
7138 | updateHookTypesDev();
|
7139 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
7140 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
7141 | try {
|
7142 | return updateMemo(create, deps);
|
7143 | } finally {
|
7144 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
7145 | }
|
7146 | },
|
7147 | useReducer: function (reducer, initialArg, init) {
|
7148 | currentHookNameInDev = 'useReducer';
|
7149 | warnInvalidHookAccess();
|
7150 | updateHookTypesDev();
|
7151 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
7152 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
7153 | try {
|
7154 | return updateReducer(reducer, initialArg, init);
|
7155 | } finally {
|
7156 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
7157 | }
|
7158 | },
|
7159 | useRef: function (initialValue) {
|
7160 | currentHookNameInDev = 'useRef';
|
7161 | warnInvalidHookAccess();
|
7162 | updateHookTypesDev();
|
7163 | return updateRef(initialValue);
|
7164 | },
|
7165 | useState: function (initialState) {
|
7166 | currentHookNameInDev = 'useState';
|
7167 | warnInvalidHookAccess();
|
7168 | updateHookTypesDev();
|
7169 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
7170 | ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
7171 | try {
|
7172 | return updateState(initialState);
|
7173 | } finally {
|
7174 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
7175 | }
|
7176 | },
|
7177 | useDebugValue: function (value, formatterFn) {
|
7178 | currentHookNameInDev = 'useDebugValue';
|
7179 | warnInvalidHookAccess();
|
7180 | updateHookTypesDev();
|
7181 | return updateDebugValue(value, formatterFn);
|
7182 | },
|
7183 | useResponder: function (responder, props) {
|
7184 | currentHookNameInDev = 'useResponder';
|
7185 | warnInvalidHookAccess();
|
7186 | updateHookTypesDev();
|
7187 | return createResponderListener(responder, props);
|
7188 | }
|
7189 | };
|
7190 | }
|
7191 |
|
7192 |
|
7193 |
|
7194 | var now$1 = Scheduler.unstable_now;
|
7195 |
|
7196 |
|
7197 | var commitTime = 0;
|
7198 | var profilerStartTime = -1;
|
7199 |
|
7200 | function getCommitTime() {
|
7201 | return commitTime;
|
7202 | }
|
7203 |
|
7204 | function recordCommitTime() {
|
7205 | if (!enableProfilerTimer) {
|
7206 | return;
|
7207 | }
|
7208 | commitTime = now$1();
|
7209 | }
|
7210 |
|
7211 | function startProfilerTimer(fiber) {
|
7212 | if (!enableProfilerTimer) {
|
7213 | return;
|
7214 | }
|
7215 |
|
7216 | profilerStartTime = now$1();
|
7217 |
|
7218 | if (fiber.actualStartTime < 0) {
|
7219 | fiber.actualStartTime = now$1();
|
7220 | }
|
7221 | }
|
7222 |
|
7223 | function stopProfilerTimerIfRunning(fiber) {
|
7224 | if (!enableProfilerTimer) {
|
7225 | return;
|
7226 | }
|
7227 | profilerStartTime = -1;
|
7228 | }
|
7229 |
|
7230 | function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
7231 | if (!enableProfilerTimer) {
|
7232 | return;
|
7233 | }
|
7234 |
|
7235 | if (profilerStartTime >= 0) {
|
7236 | var elapsedTime = now$1() - profilerStartTime;
|
7237 | fiber.actualDuration += elapsedTime;
|
7238 | if (overrideBaseTime) {
|
7239 | fiber.selfBaseDuration = elapsedTime;
|
7240 | }
|
7241 | profilerStartTime = -1;
|
7242 | }
|
7243 | }
|
7244 |
|
7245 |
|
7246 |
|
7247 | var hydrationParentFiber = null;
|
7248 | var nextHydratableInstance = null;
|
7249 | var isHydrating = false;
|
7250 |
|
7251 | function enterHydrationState(fiber) {
|
7252 | if (!supportsHydration) {
|
7253 | return false;
|
7254 | }
|
7255 |
|
7256 | var parentInstance = fiber.stateNode.containerInfo;
|
7257 | nextHydratableInstance = getFirstHydratableChild(parentInstance);
|
7258 | hydrationParentFiber = fiber;
|
7259 | isHydrating = true;
|
7260 | return true;
|
7261 | }
|
7262 |
|
7263 | function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
|
7264 | if (!supportsHydration) {
|
7265 | return false;
|
7266 | }
|
7267 |
|
7268 | var suspenseInstance = fiber.stateNode;
|
7269 | nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
|
7270 | popToNextHostParent(fiber);
|
7271 | isHydrating = true;
|
7272 | return true;
|
7273 | }
|
7274 |
|
7275 | function deleteHydratableInstance(returnFiber, instance) {
|
7276 | {
|
7277 | switch (returnFiber.tag) {
|
7278 | case HostRoot:
|
7279 | didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
|
7280 | break;
|
7281 | case HostComponent:
|
7282 | didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
|
7283 | break;
|
7284 | }
|
7285 | }
|
7286 |
|
7287 | var childToDelete = createFiberFromHostInstanceForDeletion();
|
7288 | childToDelete.stateNode = instance;
|
7289 | childToDelete.return = returnFiber;
|
7290 | childToDelete.effectTag = Deletion;
|
7291 |
|
7292 |
|
7293 |
|
7294 |
|
7295 |
|
7296 |
|
7297 | if (returnFiber.lastEffect !== null) {
|
7298 | returnFiber.lastEffect.nextEffect = childToDelete;
|
7299 | returnFiber.lastEffect = childToDelete;
|
7300 | } else {
|
7301 | returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
|
7302 | }
|
7303 | }
|
7304 |
|
7305 | function insertNonHydratedInstance(returnFiber, fiber) {
|
7306 | fiber.effectTag |= Placement;
|
7307 | {
|
7308 | switch (returnFiber.tag) {
|
7309 | case HostRoot:
|
7310 | {
|
7311 | var parentContainer = returnFiber.stateNode.containerInfo;
|
7312 | switch (fiber.tag) {
|
7313 | case HostComponent:
|
7314 | var type = fiber.type;
|
7315 | var props = fiber.pendingProps;
|
7316 | didNotFindHydratableContainerInstance(parentContainer, type, props);
|
7317 | break;
|
7318 | case HostText:
|
7319 | var text = fiber.pendingProps;
|
7320 | didNotFindHydratableContainerTextInstance(parentContainer, text);
|
7321 | break;
|
7322 | case SuspenseComponent:
|
7323 | didNotFindHydratableContainerSuspenseInstance(parentContainer);
|
7324 | break;
|
7325 | }
|
7326 | break;
|
7327 | }
|
7328 | case HostComponent:
|
7329 | {
|
7330 | var parentType = returnFiber.type;
|
7331 | var parentProps = returnFiber.memoizedProps;
|
7332 | var parentInstance = returnFiber.stateNode;
|
7333 | switch (fiber.tag) {
|
7334 | case HostComponent:
|
7335 | var _type = fiber.type;
|
7336 | var _props = fiber.pendingProps;
|
7337 | didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
|
7338 | break;
|
7339 | case HostText:
|
7340 | var _text = fiber.pendingProps;
|
7341 | didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
|
7342 | break;
|
7343 | case SuspenseComponent:
|
7344 | didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
|
7345 | break;
|
7346 | }
|
7347 | break;
|
7348 | }
|
7349 | default:
|
7350 | return;
|
7351 | }
|
7352 | }
|
7353 | }
|
7354 |
|
7355 | function tryHydrate(fiber, nextInstance) {
|
7356 | switch (fiber.tag) {
|
7357 | case HostComponent:
|
7358 | {
|
7359 | var type = fiber.type;
|
7360 | var props = fiber.pendingProps;
|
7361 | var instance = canHydrateInstance(nextInstance, type, props);
|
7362 | if (instance !== null) {
|
7363 | fiber.stateNode = instance;
|
7364 | return true;
|
7365 | }
|
7366 | return false;
|
7367 | }
|
7368 | case HostText:
|
7369 | {
|
7370 | var text = fiber.pendingProps;
|
7371 | var textInstance = canHydrateTextInstance(nextInstance, text);
|
7372 | if (textInstance !== null) {
|
7373 | fiber.stateNode = textInstance;
|
7374 | return true;
|
7375 | }
|
7376 | return false;
|
7377 | }
|
7378 | case SuspenseComponent:
|
7379 | {
|
7380 | if (enableSuspenseServerRenderer) {
|
7381 | var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
|
7382 | if (suspenseInstance !== null) {
|
7383 |
|
7384 | fiber.tag = DehydratedSuspenseComponent;
|
7385 | fiber.stateNode = suspenseInstance;
|
7386 | return true;
|
7387 | }
|
7388 | }
|
7389 | return false;
|
7390 | }
|
7391 | default:
|
7392 | return false;
|
7393 | }
|
7394 | }
|
7395 |
|
7396 | function tryToClaimNextHydratableInstance(fiber) {
|
7397 | if (!isHydrating) {
|
7398 | return;
|
7399 | }
|
7400 | var nextInstance = nextHydratableInstance;
|
7401 | if (!nextInstance) {
|
7402 |
|
7403 | insertNonHydratedInstance(hydrationParentFiber, fiber);
|
7404 | isHydrating = false;
|
7405 | hydrationParentFiber = fiber;
|
7406 | return;
|
7407 | }
|
7408 | var firstAttemptedInstance = nextInstance;
|
7409 | if (!tryHydrate(fiber, nextInstance)) {
|
7410 |
|
7411 |
|
7412 |
|
7413 | nextInstance = getNextHydratableSibling(firstAttemptedInstance);
|
7414 | if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
|
7415 |
|
7416 | insertNonHydratedInstance(hydrationParentFiber, fiber);
|
7417 | isHydrating = false;
|
7418 | hydrationParentFiber = fiber;
|
7419 | return;
|
7420 | }
|
7421 |
|
7422 |
|
7423 |
|
7424 |
|
7425 | deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
|
7426 | }
|
7427 | hydrationParentFiber = fiber;
|
7428 | nextHydratableInstance = getFirstHydratableChild(nextInstance);
|
7429 | }
|
7430 |
|
7431 | function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
7432 | if (!supportsHydration) {
|
7433 | (function () {
|
7434 | {
|
7435 | {
|
7436 | throw ReactError(Error('Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
|
7437 | }
|
7438 | }
|
7439 | })();
|
7440 | }
|
7441 |
|
7442 | var instance = fiber.stateNode;
|
7443 | var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
|
7444 |
|
7445 | fiber.updateQueue = updatePayload;
|
7446 |
|
7447 |
|
7448 | if (updatePayload !== null) {
|
7449 | return true;
|
7450 | }
|
7451 | return false;
|
7452 | }
|
7453 |
|
7454 | function prepareToHydrateHostTextInstance(fiber) {
|
7455 | if (!supportsHydration) {
|
7456 | (function () {
|
7457 | {
|
7458 | {
|
7459 | throw ReactError(Error('Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
|
7460 | }
|
7461 | }
|
7462 | })();
|
7463 | }
|
7464 |
|
7465 | var textInstance = fiber.stateNode;
|
7466 | var textContent = fiber.memoizedProps;
|
7467 | var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
|
7468 | {
|
7469 | if (shouldUpdate) {
|
7470 |
|
7471 |
|
7472 | var returnFiber = hydrationParentFiber;
|
7473 | if (returnFiber !== null) {
|
7474 | switch (returnFiber.tag) {
|
7475 | case HostRoot:
|
7476 | {
|
7477 | var parentContainer = returnFiber.stateNode.containerInfo;
|
7478 | didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
|
7479 | break;
|
7480 | }
|
7481 | case HostComponent:
|
7482 | {
|
7483 | var parentType = returnFiber.type;
|
7484 | var parentProps = returnFiber.memoizedProps;
|
7485 | var parentInstance = returnFiber.stateNode;
|
7486 | didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
|
7487 | break;
|
7488 | }
|
7489 | }
|
7490 | }
|
7491 | }
|
7492 | }
|
7493 | return shouldUpdate;
|
7494 | }
|
7495 |
|
7496 | function skipPastDehydratedSuspenseInstance(fiber) {
|
7497 | if (!supportsHydration) {
|
7498 | (function () {
|
7499 | {
|
7500 | {
|
7501 | throw ReactError(Error('Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
|
7502 | }
|
7503 | }
|
7504 | })();
|
7505 | }
|
7506 | var suspenseInstance = fiber.stateNode;
|
7507 | (function () {
|
7508 | if (!suspenseInstance) {
|
7509 | {
|
7510 | throw ReactError(Error('Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.'));
|
7511 | }
|
7512 | }
|
7513 | })();
|
7514 | nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
7515 | }
|
7516 |
|
7517 | function popToNextHostParent(fiber) {
|
7518 | var parent = fiber.return;
|
7519 | while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
|
7520 | parent = parent.return;
|
7521 | }
|
7522 | hydrationParentFiber = parent;
|
7523 | }
|
7524 |
|
7525 | function popHydrationState(fiber) {
|
7526 | if (!supportsHydration) {
|
7527 | return false;
|
7528 | }
|
7529 | if (fiber !== hydrationParentFiber) {
|
7530 |
|
7531 |
|
7532 | return false;
|
7533 | }
|
7534 | if (!isHydrating) {
|
7535 |
|
7536 |
|
7537 |
|
7538 | popToNextHostParent(fiber);
|
7539 | isHydrating = true;
|
7540 | return false;
|
7541 | }
|
7542 |
|
7543 | var type = fiber.type;
|
7544 |
|
7545 |
|
7546 |
|
7547 |
|
7548 |
|
7549 |
|
7550 | if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
|
7551 | var nextInstance = nextHydratableInstance;
|
7552 | while (nextInstance) {
|
7553 | deleteHydratableInstance(fiber, nextInstance);
|
7554 | nextInstance = getNextHydratableSibling(nextInstance);
|
7555 | }
|
7556 | }
|
7557 |
|
7558 | popToNextHostParent(fiber);
|
7559 | nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
|
7560 | return true;
|
7561 | }
|
7562 |
|
7563 | function resetHydrationState() {
|
7564 | if (!supportsHydration) {
|
7565 | return;
|
7566 | }
|
7567 |
|
7568 | hydrationParentFiber = null;
|
7569 | nextHydratableInstance = null;
|
7570 | isHydrating = false;
|
7571 | }
|
7572 |
|
7573 | var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
|
7574 |
|
7575 | var didReceiveUpdate = false;
|
7576 |
|
7577 | var didWarnAboutBadClass = void 0;
|
7578 | var didWarnAboutModulePatternComponent = void 0;
|
7579 | var didWarnAboutContextTypeOnFunctionComponent = void 0;
|
7580 | var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
|
7581 | var didWarnAboutFunctionRefs = void 0;
|
7582 | var didWarnAboutReassigningProps = void 0;
|
7583 | var didWarnAboutMaxDuration = void 0;
|
7584 | var didWarnAboutRevealOrder = void 0;
|
7585 | var didWarnAboutTailOptions = void 0;
|
7586 | var didWarnAboutDefaultPropsOnFunctionComponent = void 0;
|
7587 |
|
7588 | {
|
7589 | didWarnAboutBadClass = {};
|
7590 | didWarnAboutModulePatternComponent = {};
|
7591 | didWarnAboutContextTypeOnFunctionComponent = {};
|
7592 | didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
7593 | didWarnAboutFunctionRefs = {};
|
7594 | didWarnAboutReassigningProps = false;
|
7595 | didWarnAboutMaxDuration = false;
|
7596 | didWarnAboutRevealOrder = {};
|
7597 | didWarnAboutTailOptions = {};
|
7598 | didWarnAboutDefaultPropsOnFunctionComponent = {};
|
7599 | }
|
7600 |
|
7601 | function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
7602 | if (current$$1 === null) {
|
7603 |
|
7604 |
|
7605 |
|
7606 |
|
7607 | workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
7608 | } else {
|
7609 |
|
7610 |
|
7611 |
|
7612 |
|
7613 |
|
7614 |
|
7615 | workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, nextChildren, renderExpirationTime);
|
7616 | }
|
7617 | }
|
7618 |
|
7619 | function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
|
7620 |
|
7621 |
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 | workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
|
7629 |
|
7630 |
|
7631 |
|
7632 |
|
7633 | workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
7634 | }
|
7635 |
|
7636 | function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
7637 |
|
7638 |
|
7639 |
|
7640 |
|
7641 | {
|
7642 | if (workInProgress.type !== workInProgress.elementType) {
|
7643 |
|
7644 |
|
7645 | var innerPropTypes = Component.propTypes;
|
7646 | if (innerPropTypes) {
|
7647 | checkPropTypes(innerPropTypes, nextProps,
|
7648 | 'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
7649 | }
|
7650 | }
|
7651 | }
|
7652 |
|
7653 | var render = Component.render;
|
7654 | var ref = workInProgress.ref;
|
7655 |
|
7656 |
|
7657 | var nextChildren = void 0;
|
7658 | prepareToReadContext(workInProgress, renderExpirationTime);
|
7659 | {
|
7660 | ReactCurrentOwner$2.current = workInProgress;
|
7661 | setCurrentPhase('render');
|
7662 | nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
7663 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
7664 |
|
7665 | if (workInProgress.memoizedState !== null) {
|
7666 | nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
|
7667 | }
|
7668 | }
|
7669 | setCurrentPhase(null);
|
7670 | }
|
7671 |
|
7672 | if (current$$1 !== null && !didReceiveUpdate) {
|
7673 | bailoutHooks(current$$1, workInProgress, renderExpirationTime);
|
7674 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
7675 | }
|
7676 |
|
7677 |
|
7678 | workInProgress.effectTag |= PerformedWork;
|
7679 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
7680 | return workInProgress.child;
|
7681 | }
|
7682 |
|
7683 | function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
7684 | if (current$$1 === null) {
|
7685 | var type = Component.type;
|
7686 | if (isSimpleFunctionComponent(type) && Component.compare === null &&
|
7687 |
|
7688 | Component.defaultProps === undefined) {
|
7689 | var resolvedType = type;
|
7690 | {
|
7691 | resolvedType = resolveFunctionForHotReloading(type);
|
7692 | }
|
7693 |
|
7694 |
|
7695 |
|
7696 | workInProgress.tag = SimpleMemoComponent;
|
7697 | workInProgress.type = resolvedType;
|
7698 | {
|
7699 | validateFunctionComponentInDev(workInProgress, type);
|
7700 | }
|
7701 | return updateSimpleMemoComponent(current$$1, workInProgress, resolvedType, nextProps, updateExpirationTime, renderExpirationTime);
|
7702 | }
|
7703 | {
|
7704 | var innerPropTypes = type.propTypes;
|
7705 | if (innerPropTypes) {
|
7706 |
|
7707 |
|
7708 | checkPropTypes(innerPropTypes, nextProps,
|
7709 | 'prop', getComponentName(type), getCurrentFiberStackInDev);
|
7710 | }
|
7711 | }
|
7712 | var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
|
7713 | child.ref = workInProgress.ref;
|
7714 | child.return = workInProgress;
|
7715 | workInProgress.child = child;
|
7716 | return child;
|
7717 | }
|
7718 | {
|
7719 | var _type = Component.type;
|
7720 | var _innerPropTypes = _type.propTypes;
|
7721 | if (_innerPropTypes) {
|
7722 |
|
7723 |
|
7724 | checkPropTypes(_innerPropTypes, nextProps,
|
7725 | 'prop', getComponentName(_type), getCurrentFiberStackInDev);
|
7726 | }
|
7727 | }
|
7728 | var currentChild = current$$1.child;
|
7729 | if (updateExpirationTime < renderExpirationTime) {
|
7730 |
|
7731 |
|
7732 | var prevProps = currentChild.memoizedProps;
|
7733 |
|
7734 | var compare = Component.compare;
|
7735 | compare = compare !== null ? compare : shallowEqual;
|
7736 | if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
|
7737 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
7738 | }
|
7739 | }
|
7740 |
|
7741 | workInProgress.effectTag |= PerformedWork;
|
7742 | var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
|
7743 | newChild.ref = workInProgress.ref;
|
7744 | newChild.return = workInProgress;
|
7745 | workInProgress.child = newChild;
|
7746 | return newChild;
|
7747 | }
|
7748 |
|
7749 | function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
|
7750 |
|
7751 |
|
7752 |
|
7753 |
|
7754 | {
|
7755 | if (workInProgress.type !== workInProgress.elementType) {
|
7756 |
|
7757 |
|
7758 | var outerMemoType = workInProgress.elementType;
|
7759 | if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
|
7760 |
|
7761 |
|
7762 |
|
7763 | outerMemoType = refineResolvedLazyComponent(outerMemoType);
|
7764 | }
|
7765 | var outerPropTypes = outerMemoType && outerMemoType.propTypes;
|
7766 | if (outerPropTypes) {
|
7767 | checkPropTypes(outerPropTypes, nextProps,
|
7768 | 'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
|
7769 | }
|
7770 |
|
7771 | }
|
7772 | }
|
7773 | if (current$$1 !== null) {
|
7774 | var prevProps = current$$1.memoizedProps;
|
7775 | if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref && (
|
7776 |
|
7777 | workInProgress.type === current$$1.type)) {
|
7778 | didReceiveUpdate = false;
|
7779 | if (updateExpirationTime < renderExpirationTime) {
|
7780 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
7781 | }
|
7782 | }
|
7783 | }
|
7784 | return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
7785 | }
|
7786 |
|
7787 | function updateFragment(current$$1, workInProgress, renderExpirationTime) {
|
7788 | var nextChildren = workInProgress.pendingProps;
|
7789 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
7790 | return workInProgress.child;
|
7791 | }
|
7792 |
|
7793 | function updateMode(current$$1, workInProgress, renderExpirationTime) {
|
7794 | var nextChildren = workInProgress.pendingProps.children;
|
7795 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
7796 | return workInProgress.child;
|
7797 | }
|
7798 |
|
7799 | function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
|
7800 | if (enableProfilerTimer) {
|
7801 | workInProgress.effectTag |= Update;
|
7802 | }
|
7803 | var nextProps = workInProgress.pendingProps;
|
7804 | var nextChildren = nextProps.children;
|
7805 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
7806 | return workInProgress.child;
|
7807 | }
|
7808 |
|
7809 | function markRef(current$$1, workInProgress) {
|
7810 | var ref = workInProgress.ref;
|
7811 | if (current$$1 === null && ref !== null || current$$1 !== null && current$$1.ref !== ref) {
|
7812 |
|
7813 | workInProgress.effectTag |= Ref;
|
7814 | }
|
7815 | }
|
7816 |
|
7817 | function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
7818 | {
|
7819 | if (workInProgress.type !== workInProgress.elementType) {
|
7820 |
|
7821 |
|
7822 | var innerPropTypes = Component.propTypes;
|
7823 | if (innerPropTypes) {
|
7824 | checkPropTypes(innerPropTypes, nextProps,
|
7825 | 'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
7826 | }
|
7827 | }
|
7828 | }
|
7829 |
|
7830 | var context = void 0;
|
7831 | if (!disableLegacyContext) {
|
7832 | var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
|
7833 | context = getMaskedContext(workInProgress, unmaskedContext);
|
7834 | }
|
7835 |
|
7836 | var nextChildren = void 0;
|
7837 | prepareToReadContext(workInProgress, renderExpirationTime);
|
7838 | {
|
7839 | ReactCurrentOwner$2.current = workInProgress;
|
7840 | setCurrentPhase('render');
|
7841 | nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
7842 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
7843 |
|
7844 | if (workInProgress.memoizedState !== null) {
|
7845 | nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
|
7846 | }
|
7847 | }
|
7848 | setCurrentPhase(null);
|
7849 | }
|
7850 |
|
7851 | if (current$$1 !== null && !didReceiveUpdate) {
|
7852 | bailoutHooks(current$$1, workInProgress, renderExpirationTime);
|
7853 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
7854 | }
|
7855 |
|
7856 |
|
7857 | workInProgress.effectTag |= PerformedWork;
|
7858 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
7859 | return workInProgress.child;
|
7860 | }
|
7861 |
|
7862 | function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
|
7863 | {
|
7864 | if (workInProgress.type !== workInProgress.elementType) {
|
7865 |
|
7866 |
|
7867 | var innerPropTypes = Component.propTypes;
|
7868 | if (innerPropTypes) {
|
7869 | checkPropTypes(innerPropTypes, nextProps,
|
7870 | 'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
7871 | }
|
7872 | }
|
7873 | }
|
7874 |
|
7875 |
|
7876 |
|
7877 |
|
7878 | var hasContext = void 0;
|
7879 | if (isContextProvider(Component)) {
|
7880 | hasContext = true;
|
7881 | pushContextProvider(workInProgress);
|
7882 | } else {
|
7883 | hasContext = false;
|
7884 | }
|
7885 | prepareToReadContext(workInProgress, renderExpirationTime);
|
7886 |
|
7887 | var instance = workInProgress.stateNode;
|
7888 | var shouldUpdate = void 0;
|
7889 | if (instance === null) {
|
7890 | if (current$$1 !== null) {
|
7891 |
|
7892 |
|
7893 |
|
7894 |
|
7895 | current$$1.alternate = null;
|
7896 | workInProgress.alternate = null;
|
7897 |
|
7898 | workInProgress.effectTag |= Placement;
|
7899 | }
|
7900 |
|
7901 | constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
7902 | mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
7903 | shouldUpdate = true;
|
7904 | } else if (current$$1 === null) {
|
7905 |
|
7906 | shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
7907 | } else {
|
7908 | shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
|
7909 | }
|
7910 | var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
|
7911 | {
|
7912 | var inst = workInProgress.stateNode;
|
7913 | if (inst.props !== nextProps) {
|
7914 | !didWarnAboutReassigningProps ? warning$1(false, 'It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component') : void 0;
|
7915 | didWarnAboutReassigningProps = true;
|
7916 | }
|
7917 | }
|
7918 | return nextUnitOfWork;
|
7919 | }
|
7920 |
|
7921 | function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
|
7922 |
|
7923 | markRef(current$$1, workInProgress);
|
7924 |
|
7925 | var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
|
7926 |
|
7927 | if (!shouldUpdate && !didCaptureError) {
|
7928 |
|
7929 | if (hasContext) {
|
7930 | invalidateContextProvider(workInProgress, Component, false);
|
7931 | }
|
7932 |
|
7933 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
7934 | }
|
7935 |
|
7936 | var instance = workInProgress.stateNode;
|
7937 |
|
7938 |
|
7939 | ReactCurrentOwner$2.current = workInProgress;
|
7940 | var nextChildren = void 0;
|
7941 | if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
|
7942 |
|
7943 |
|
7944 |
|
7945 |
|
7946 |
|
7947 | nextChildren = null;
|
7948 |
|
7949 | if (enableProfilerTimer) {
|
7950 | stopProfilerTimerIfRunning(workInProgress);
|
7951 | }
|
7952 | } else {
|
7953 | {
|
7954 | setCurrentPhase('render');
|
7955 | nextChildren = instance.render();
|
7956 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
7957 | instance.render();
|
7958 | }
|
7959 | setCurrentPhase(null);
|
7960 | }
|
7961 | }
|
7962 |
|
7963 |
|
7964 | workInProgress.effectTag |= PerformedWork;
|
7965 | if (current$$1 !== null && didCaptureError) {
|
7966 |
|
7967 |
|
7968 |
|
7969 |
|
7970 | forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
7971 | } else {
|
7972 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
7973 | }
|
7974 |
|
7975 |
|
7976 |
|
7977 | workInProgress.memoizedState = instance.state;
|
7978 |
|
7979 |
|
7980 | if (hasContext) {
|
7981 | invalidateContextProvider(workInProgress, Component, true);
|
7982 | }
|
7983 |
|
7984 | return workInProgress.child;
|
7985 | }
|
7986 |
|
7987 | function pushHostRootContext(workInProgress) {
|
7988 | var root = workInProgress.stateNode;
|
7989 | if (root.pendingContext) {
|
7990 | pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
|
7991 | } else if (root.context) {
|
7992 |
|
7993 | pushTopLevelContextObject(workInProgress, root.context, false);
|
7994 | }
|
7995 | pushHostContainer(workInProgress, root.containerInfo);
|
7996 | }
|
7997 |
|
7998 | function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
|
7999 | pushHostRootContext(workInProgress);
|
8000 | var updateQueue = workInProgress.updateQueue;
|
8001 | (function () {
|
8002 | if (!(updateQueue !== null)) {
|
8003 | {
|
8004 | throw ReactError(Error('If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.'));
|
8005 | }
|
8006 | }
|
8007 | })();
|
8008 | var nextProps = workInProgress.pendingProps;
|
8009 | var prevState = workInProgress.memoizedState;
|
8010 | var prevChildren = prevState !== null ? prevState.element : null;
|
8011 | processUpdateQueue(workInProgress, updateQueue, nextProps, null, renderExpirationTime);
|
8012 | var nextState = workInProgress.memoizedState;
|
8013 |
|
8014 |
|
8015 | var nextChildren = nextState.element;
|
8016 | if (nextChildren === prevChildren) {
|
8017 |
|
8018 |
|
8019 | resetHydrationState();
|
8020 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
8021 | }
|
8022 | var root = workInProgress.stateNode;
|
8023 | if ((current$$1 === null || current$$1.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
|
8024 |
|
8025 |
|
8026 |
|
8027 |
|
8028 |
|
8029 |
|
8030 |
|
8031 |
|
8032 |
|
8033 | workInProgress.effectTag |= Placement;
|
8034 |
|
8035 |
|
8036 |
|
8037 |
|
8038 | workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
8039 | } else {
|
8040 |
|
8041 |
|
8042 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
8043 | resetHydrationState();
|
8044 | }
|
8045 | return workInProgress.child;
|
8046 | }
|
8047 |
|
8048 | function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
|
8049 | pushHostContext(workInProgress);
|
8050 |
|
8051 | if (current$$1 === null) {
|
8052 | tryToClaimNextHydratableInstance(workInProgress);
|
8053 | }
|
8054 |
|
8055 | var type = workInProgress.type;
|
8056 | var nextProps = workInProgress.pendingProps;
|
8057 | var prevProps = current$$1 !== null ? current$$1.memoizedProps : null;
|
8058 |
|
8059 | var nextChildren = nextProps.children;
|
8060 | var isDirectTextChild = shouldSetTextContent(type, nextProps);
|
8061 |
|
8062 | if (isDirectTextChild) {
|
8063 |
|
8064 |
|
8065 |
|
8066 |
|
8067 | nextChildren = null;
|
8068 | } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
|
8069 |
|
8070 |
|
8071 | workInProgress.effectTag |= ContentReset;
|
8072 | }
|
8073 |
|
8074 | markRef(current$$1, workInProgress);
|
8075 |
|
8076 |
|
8077 | if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps)) {
|
8078 | if (enableSchedulerTracing) {
|
8079 | markSpawnedWork(Never);
|
8080 | }
|
8081 |
|
8082 | workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
|
8083 | return null;
|
8084 | }
|
8085 |
|
8086 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
8087 | return workInProgress.child;
|
8088 | }
|
8089 |
|
8090 | function updateHostText(current$$1, workInProgress) {
|
8091 | if (current$$1 === null) {
|
8092 | tryToClaimNextHydratableInstance(workInProgress);
|
8093 | }
|
8094 |
|
8095 |
|
8096 | return null;
|
8097 | }
|
8098 |
|
8099 | function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
|
8100 | if (_current !== null) {
|
8101 |
|
8102 |
|
8103 |
|
8104 |
|
8105 | _current.alternate = null;
|
8106 | workInProgress.alternate = null;
|
8107 |
|
8108 | workInProgress.effectTag |= Placement;
|
8109 | }
|
8110 |
|
8111 | var props = workInProgress.pendingProps;
|
8112 |
|
8113 |
|
8114 | cancelWorkTimer(workInProgress);
|
8115 | var Component = readLazyComponentType(elementType);
|
8116 |
|
8117 | workInProgress.type = Component;
|
8118 | var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
|
8119 | startWorkTimer(workInProgress);
|
8120 | var resolvedProps = resolveDefaultProps(Component, props);
|
8121 | var child = void 0;
|
8122 | switch (resolvedTag) {
|
8123 | case FunctionComponent:
|
8124 | {
|
8125 | {
|
8126 | validateFunctionComponentInDev(workInProgress, Component);
|
8127 | workInProgress.type = Component = resolveFunctionForHotReloading(Component);
|
8128 | }
|
8129 | child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
8130 | break;
|
8131 | }
|
8132 | case ClassComponent:
|
8133 | {
|
8134 | {
|
8135 | workInProgress.type = Component = resolveClassForHotReloading(Component);
|
8136 | }
|
8137 | child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
8138 | break;
|
8139 | }
|
8140 | case ForwardRef:
|
8141 | {
|
8142 | {
|
8143 | workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
|
8144 | }
|
8145 | child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
|
8146 | break;
|
8147 | }
|
8148 | case MemoComponent:
|
8149 | {
|
8150 | {
|
8151 | if (workInProgress.type !== workInProgress.elementType) {
|
8152 | var outerPropTypes = Component.propTypes;
|
8153 | if (outerPropTypes) {
|
8154 | checkPropTypes(outerPropTypes, resolvedProps,
|
8155 | 'prop', getComponentName(Component), getCurrentFiberStackInDev);
|
8156 | }
|
8157 | }
|
8158 | }
|
8159 | child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps),
|
8160 | updateExpirationTime, renderExpirationTime);
|
8161 | break;
|
8162 | }
|
8163 | default:
|
8164 | {
|
8165 | var hint = '';
|
8166 | {
|
8167 | if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
|
8168 | hint = ' Did you wrap a component in React.lazy() more than once?';
|
8169 | }
|
8170 | }
|
8171 |
|
8172 |
|
8173 |
|
8174 | (function () {
|
8175 | {
|
8176 | {
|
8177 | throw ReactError(Error('Element type is invalid. Received a promise that resolves to: ' + Component + '. Lazy element type must resolve to a class or function.' + hint));
|
8178 | }
|
8179 | }
|
8180 | })();
|
8181 | }
|
8182 | }
|
8183 | return child;
|
8184 | }
|
8185 |
|
8186 | function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
|
8187 | if (_current !== null) {
|
8188 |
|
8189 |
|
8190 |
|
8191 |
|
8192 | _current.alternate = null;
|
8193 | workInProgress.alternate = null;
|
8194 |
|
8195 | workInProgress.effectTag |= Placement;
|
8196 | }
|
8197 |
|
8198 |
|
8199 | workInProgress.tag = ClassComponent;
|
8200 |
|
8201 |
|
8202 |
|
8203 |
|
8204 |
|
8205 |
|
8206 | var hasContext = void 0;
|
8207 | if (isContextProvider(Component)) {
|
8208 | hasContext = true;
|
8209 | pushContextProvider(workInProgress);
|
8210 | } else {
|
8211 | hasContext = false;
|
8212 | }
|
8213 | prepareToReadContext(workInProgress, renderExpirationTime);
|
8214 |
|
8215 | constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
8216 | mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
|
8217 |
|
8218 | return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
8219 | }
|
8220 |
|
8221 | function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
|
8222 | if (_current !== null) {
|
8223 |
|
8224 |
|
8225 |
|
8226 |
|
8227 | _current.alternate = null;
|
8228 | workInProgress.alternate = null;
|
8229 |
|
8230 | workInProgress.effectTag |= Placement;
|
8231 | }
|
8232 |
|
8233 | var props = workInProgress.pendingProps;
|
8234 | var context = void 0;
|
8235 | if (!disableLegacyContext) {
|
8236 | var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
8237 | context = getMaskedContext(workInProgress, unmaskedContext);
|
8238 | }
|
8239 |
|
8240 | prepareToReadContext(workInProgress, renderExpirationTime);
|
8241 | var value = void 0;
|
8242 |
|
8243 | {
|
8244 | if (Component.prototype && typeof Component.prototype.render === 'function') {
|
8245 | var componentName = getComponentName(Component) || 'Unknown';
|
8246 |
|
8247 | if (!didWarnAboutBadClass[componentName]) {
|
8248 | warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
|
8249 | didWarnAboutBadClass[componentName] = true;
|
8250 | }
|
8251 | }
|
8252 |
|
8253 | if (workInProgress.mode & StrictMode) {
|
8254 | ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
|
8255 | }
|
8256 |
|
8257 | ReactCurrentOwner$2.current = workInProgress;
|
8258 | value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
8259 | }
|
8260 |
|
8261 | workInProgress.effectTag |= PerformedWork;
|
8262 |
|
8263 | if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
8264 | {
|
8265 | var _componentName = getComponentName(Component) || 'Unknown';
|
8266 | if (!didWarnAboutModulePatternComponent[_componentName]) {
|
8267 | warningWithoutStack$1(false, 'The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName);
|
8268 | didWarnAboutModulePatternComponent[_componentName] = true;
|
8269 | }
|
8270 | }
|
8271 |
|
8272 |
|
8273 | workInProgress.tag = ClassComponent;
|
8274 |
|
8275 |
|
8276 | resetHooks();
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 | var hasContext = false;
|
8282 | if (isContextProvider(Component)) {
|
8283 | hasContext = true;
|
8284 | pushContextProvider(workInProgress);
|
8285 | } else {
|
8286 | hasContext = false;
|
8287 | }
|
8288 |
|
8289 | workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
|
8290 |
|
8291 | var getDerivedStateFromProps = Component.getDerivedStateFromProps;
|
8292 | if (typeof getDerivedStateFromProps === 'function') {
|
8293 | applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
|
8294 | }
|
8295 |
|
8296 | adoptClassInstance(workInProgress, value);
|
8297 | mountClassInstance(workInProgress, Component, props, renderExpirationTime);
|
8298 | return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
|
8299 | } else {
|
8300 |
|
8301 | workInProgress.tag = FunctionComponent;
|
8302 | {
|
8303 | if (disableLegacyContext && Component.contextTypes) {
|
8304 | warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
|
8305 | }
|
8306 |
|
8307 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
|
8308 |
|
8309 | if (workInProgress.memoizedState !== null) {
|
8310 | value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
|
8311 | }
|
8312 | }
|
8313 | }
|
8314 | reconcileChildren(null, workInProgress, value, renderExpirationTime);
|
8315 | {
|
8316 | validateFunctionComponentInDev(workInProgress, Component);
|
8317 | }
|
8318 | return workInProgress.child;
|
8319 | }
|
8320 | }
|
8321 |
|
8322 | function validateFunctionComponentInDev(workInProgress, Component) {
|
8323 | if (Component) {
|
8324 | !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
|
8325 | }
|
8326 | if (workInProgress.ref !== null) {
|
8327 | var info = '';
|
8328 | var ownerName = getCurrentFiberOwnerNameInDevOrNull();
|
8329 | if (ownerName) {
|
8330 | info += '\n\nCheck the render method of `' + ownerName + '`.';
|
8331 | }
|
8332 |
|
8333 | var warningKey = ownerName || workInProgress._debugID || '';
|
8334 | var debugSource = workInProgress._debugSource;
|
8335 | if (debugSource) {
|
8336 | warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
|
8337 | }
|
8338 | if (!didWarnAboutFunctionRefs[warningKey]) {
|
8339 | didWarnAboutFunctionRefs[warningKey] = true;
|
8340 | warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info);
|
8341 | }
|
8342 | }
|
8343 |
|
8344 | if (warnAboutDefaultPropsOnFunctionComponents && Component.defaultProps !== undefined) {
|
8345 | var componentName = getComponentName(Component) || 'Unknown';
|
8346 |
|
8347 | if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
|
8348 | warningWithoutStack$1(false, '%s: Support for defaultProps will be removed from function components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName);
|
8349 | didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
|
8350 | }
|
8351 | }
|
8352 |
|
8353 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
8354 | var _componentName2 = getComponentName(Component) || 'Unknown';
|
8355 |
|
8356 | if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) {
|
8357 | warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', _componentName2);
|
8358 | didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true;
|
8359 | }
|
8360 | }
|
8361 |
|
8362 | if (typeof Component.contextType === 'object' && Component.contextType !== null) {
|
8363 | var _componentName3 = getComponentName(Component) || 'Unknown';
|
8364 |
|
8365 | if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) {
|
8366 | warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName3);
|
8367 | didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true;
|
8368 | }
|
8369 | }
|
8370 | }
|
8371 |
|
8372 |
|
8373 | var SUSPENDED_MARKER = {};
|
8374 |
|
8375 | function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
|
8376 |
|
8377 |
|
8378 | return hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && (current$$1 === null || current$$1.memoizedState !== null);
|
8379 | }
|
8380 |
|
8381 | function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
8382 | var mode = workInProgress.mode;
|
8383 | var nextProps = workInProgress.pendingProps;
|
8384 |
|
8385 |
|
8386 | {
|
8387 | if (shouldSuspend(workInProgress)) {
|
8388 | workInProgress.effectTag |= DidCapture;
|
8389 | }
|
8390 | }
|
8391 |
|
8392 | var suspenseContext = suspenseStackCursor.current;
|
8393 |
|
8394 | var nextState = null;
|
8395 | var nextDidTimeout = false;
|
8396 |
|
8397 | if ((workInProgress.effectTag & DidCapture) !== NoEffect || shouldRemainOnFallback(suspenseContext, current$$1, workInProgress)) {
|
8398 |
|
8399 |
|
8400 | nextState = SUSPENDED_MARKER;
|
8401 | nextDidTimeout = true;
|
8402 | workInProgress.effectTag &= ~DidCapture;
|
8403 | } else {
|
8404 |
|
8405 | if (current$$1 === null || current$$1.memoizedState !== null) {
|
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 | if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) {
|
8412 | suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
|
8413 | }
|
8414 | }
|
8415 | }
|
8416 |
|
8417 | suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
8418 |
|
8419 | pushSuspenseContext(workInProgress, suspenseContext);
|
8420 |
|
8421 | {
|
8422 | if ('maxDuration' in nextProps) {
|
8423 | if (!didWarnAboutMaxDuration) {
|
8424 | didWarnAboutMaxDuration = true;
|
8425 | warning$1(false, 'maxDuration has been removed from React. ' + 'Remove the maxDuration prop.');
|
8426 | }
|
8427 | }
|
8428 | }
|
8429 |
|
8430 |
|
8431 |
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 |
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 |
|
8448 |
|
8449 |
|
8450 |
|
8451 |
|
8452 |
|
8453 |
|
8454 |
|
8455 | var child = void 0;
|
8456 |
|
8457 |
|
8458 |
|
8459 |
|
8460 | var next = void 0;
|
8461 | if (current$$1 === null) {
|
8462 | if (enableSuspenseServerRenderer) {
|
8463 |
|
8464 |
|
8465 | if (nextProps.fallback !== undefined) {
|
8466 | tryToClaimNextHydratableInstance(workInProgress);
|
8467 |
|
8468 | if (workInProgress.tag === DehydratedSuspenseComponent) {
|
8469 | popSuspenseContext(workInProgress);
|
8470 | return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
|
8471 | }
|
8472 | }
|
8473 | }
|
8474 |
|
8475 |
|
8476 |
|
8477 | if (nextDidTimeout) {
|
8478 |
|
8479 | var nextFallbackChildren = nextProps.fallback;
|
8480 | var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
|
8481 | primaryChildFragment.return = workInProgress;
|
8482 |
|
8483 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
8484 |
|
8485 | var progressedState = workInProgress.memoizedState;
|
8486 | var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
8487 | primaryChildFragment.child = progressedPrimaryChild;
|
8488 | var progressedChild = progressedPrimaryChild;
|
8489 | while (progressedChild !== null) {
|
8490 | progressedChild.return = primaryChildFragment;
|
8491 | progressedChild = progressedChild.sibling;
|
8492 | }
|
8493 | }
|
8494 |
|
8495 | var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
|
8496 | fallbackChildFragment.return = workInProgress;
|
8497 | primaryChildFragment.sibling = fallbackChildFragment;
|
8498 | child = primaryChildFragment;
|
8499 |
|
8500 |
|
8501 | next = fallbackChildFragment;
|
8502 | } else {
|
8503 |
|
8504 | var nextPrimaryChildren = nextProps.children;
|
8505 | child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
|
8506 | }
|
8507 | } else {
|
8508 |
|
8509 |
|
8510 | var prevState = current$$1.memoizedState;
|
8511 | var prevDidTimeout = prevState !== null;
|
8512 | if (prevDidTimeout) {
|
8513 |
|
8514 | var currentPrimaryChildFragment = current$$1.child;
|
8515 | var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
8516 | if (nextDidTimeout) {
|
8517 |
|
8518 |
|
8519 | var _nextFallbackChildren = nextProps.fallback;
|
8520 | var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
|
8521 | _primaryChildFragment.return = workInProgress;
|
8522 |
|
8523 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
8524 |
|
8525 | var _progressedState = workInProgress.memoizedState;
|
8526 | var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
|
8527 | if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
|
8528 | _primaryChildFragment.child = _progressedPrimaryChild;
|
8529 | var _progressedChild = _progressedPrimaryChild;
|
8530 | while (_progressedChild !== null) {
|
8531 | _progressedChild.return = _primaryChildFragment;
|
8532 | _progressedChild = _progressedChild.sibling;
|
8533 | }
|
8534 | }
|
8535 | }
|
8536 |
|
8537 |
|
8538 |
|
8539 | if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
|
8540 |
|
8541 | var treeBaseDuration = 0;
|
8542 | var hiddenChild = _primaryChildFragment.child;
|
8543 | while (hiddenChild !== null) {
|
8544 | treeBaseDuration += hiddenChild.treeBaseDuration;
|
8545 | hiddenChild = hiddenChild.sibling;
|
8546 | }
|
8547 | _primaryChildFragment.treeBaseDuration = treeBaseDuration;
|
8548 | }
|
8549 |
|
8550 |
|
8551 |
|
8552 | var _fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
|
8553 | _fallbackChildFragment.return = workInProgress;
|
8554 | _primaryChildFragment.sibling = _fallbackChildFragment;
|
8555 | child = _primaryChildFragment;
|
8556 | _primaryChildFragment.childExpirationTime = NoWork;
|
8557 |
|
8558 |
|
8559 | next = _fallbackChildFragment;
|
8560 | } else {
|
8561 |
|
8562 |
|
8563 | var _nextPrimaryChildren = nextProps.children;
|
8564 | var currentPrimaryChild = currentPrimaryChildFragment.child;
|
8565 | var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
|
8566 |
|
8567 |
|
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 |
|
8574 | child = next = primaryChild;
|
8575 | }
|
8576 | } else {
|
8577 |
|
8578 |
|
8579 | var _currentPrimaryChild = current$$1.child;
|
8580 | if (nextDidTimeout) {
|
8581 |
|
8582 |
|
8583 | var _nextFallbackChildren2 = nextProps.fallback;
|
8584 | var _primaryChildFragment2 = createFiberFromFragment(
|
8585 |
|
8586 |
|
8587 | null, mode, NoWork, null);
|
8588 | _primaryChildFragment2.return = workInProgress;
|
8589 | _primaryChildFragment2.child = _currentPrimaryChild;
|
8590 | if (_currentPrimaryChild !== null) {
|
8591 | _currentPrimaryChild.return = _primaryChildFragment2;
|
8592 | }
|
8593 |
|
8594 |
|
8595 |
|
8596 |
|
8597 |
|
8598 |
|
8599 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
8600 |
|
8601 | var _progressedState2 = workInProgress.memoizedState;
|
8602 | var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
|
8603 | _primaryChildFragment2.child = _progressedPrimaryChild2;
|
8604 | var _progressedChild2 = _progressedPrimaryChild2;
|
8605 | while (_progressedChild2 !== null) {
|
8606 | _progressedChild2.return = _primaryChildFragment2;
|
8607 | _progressedChild2 = _progressedChild2.sibling;
|
8608 | }
|
8609 | }
|
8610 |
|
8611 |
|
8612 |
|
8613 | if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
|
8614 |
|
8615 | var _treeBaseDuration = 0;
|
8616 | var _hiddenChild = _primaryChildFragment2.child;
|
8617 | while (_hiddenChild !== null) {
|
8618 | _treeBaseDuration += _hiddenChild.treeBaseDuration;
|
8619 | _hiddenChild = _hiddenChild.sibling;
|
8620 | }
|
8621 | _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
|
8622 | }
|
8623 |
|
8624 |
|
8625 | var _fallbackChildFragment2 = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
|
8626 | _fallbackChildFragment2.return = workInProgress;
|
8627 | _primaryChildFragment2.sibling = _fallbackChildFragment2;
|
8628 | _fallbackChildFragment2.effectTag |= Placement;
|
8629 | child = _primaryChildFragment2;
|
8630 | _primaryChildFragment2.childExpirationTime = NoWork;
|
8631 |
|
8632 |
|
8633 | next = _fallbackChildFragment2;
|
8634 | } else {
|
8635 |
|
8636 |
|
8637 | var _nextPrimaryChildren2 = nextProps.children;
|
8638 | next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
|
8639 | }
|
8640 | }
|
8641 | workInProgress.stateNode = current$$1.stateNode;
|
8642 | }
|
8643 |
|
8644 | workInProgress.memoizedState = nextState;
|
8645 | workInProgress.child = child;
|
8646 | return next;
|
8647 | }
|
8648 |
|
8649 | function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime) {
|
8650 |
|
8651 | current$$1.alternate = null;
|
8652 | workInProgress.alternate = null;
|
8653 |
|
8654 |
|
8655 | var returnFiber = workInProgress.return;
|
8656 | (function () {
|
8657 | if (!(returnFiber !== null)) {
|
8658 | {
|
8659 | throw ReactError(Error('Suspense boundaries are never on the root. This is probably a bug in React.'));
|
8660 | }
|
8661 | }
|
8662 | })();
|
8663 | var last = returnFiber.lastEffect;
|
8664 | if (last !== null) {
|
8665 | last.nextEffect = current$$1;
|
8666 | returnFiber.lastEffect = current$$1;
|
8667 | } else {
|
8668 | returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
|
8669 | }
|
8670 | current$$1.nextEffect = null;
|
8671 | current$$1.effectTag = Deletion;
|
8672 |
|
8673 | popSuspenseContext(workInProgress);
|
8674 |
|
8675 |
|
8676 | workInProgress.tag = SuspenseComponent;
|
8677 | workInProgress.stateNode = null;
|
8678 | workInProgress.memoizedState = null;
|
8679 |
|
8680 | workInProgress.effectTag |= Placement;
|
8681 |
|
8682 | return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
|
8683 | }
|
8684 |
|
8685 | function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
|
8686 | pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
8687 | var suspenseInstance = workInProgress.stateNode;
|
8688 | if (current$$1 === null) {
|
8689 |
|
8690 |
|
8691 | if (isSuspenseInstanceFallback(suspenseInstance)) {
|
8692 |
|
8693 |
|
8694 |
|
8695 |
|
8696 |
|
8697 |
|
8698 |
|
8699 |
|
8700 |
|
8701 |
|
8702 |
|
8703 | var serverDisplayTime = requestCurrentTime();
|
8704 |
|
8705 | workInProgress.expirationTime = computeAsyncExpiration(serverDisplayTime);
|
8706 | } else {
|
8707 |
|
8708 |
|
8709 | workInProgress.expirationTime = Never;
|
8710 | }
|
8711 | return null;
|
8712 | }
|
8713 | if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
|
8714 |
|
8715 |
|
8716 | workInProgress.child = null;
|
8717 | return null;
|
8718 | }
|
8719 | if (isSuspenseInstanceFallback(suspenseInstance)) {
|
8720 |
|
8721 |
|
8722 |
|
8723 | return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
8724 | }
|
8725 |
|
8726 |
|
8727 | var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
|
8728 | if (didReceiveUpdate || hasContextChanged$$1) {
|
8729 |
|
8730 |
|
8731 |
|
8732 |
|
8733 |
|
8734 |
|
8735 | return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
|
8736 | } else if (isSuspenseInstancePending(suspenseInstance)) {
|
8737 |
|
8738 |
|
8739 |
|
8740 |
|
8741 |
|
8742 |
|
8743 |
|
8744 |
|
8745 |
|
8746 | workInProgress.effectTag |= DidCapture;
|
8747 |
|
8748 | workInProgress.child = null;
|
8749 |
|
8750 | registerSuspenseInstanceRetry(suspenseInstance, retryTimedOutBoundary.bind(null, current$$1));
|
8751 | return null;
|
8752 | } else {
|
8753 |
|
8754 | reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
|
8755 | var nextProps = workInProgress.pendingProps;
|
8756 | var nextChildren = nextProps.children;
|
8757 | workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
8758 | return workInProgress.child;
|
8759 | }
|
8760 | }
|
8761 |
|
8762 | function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
|
8763 |
|
8764 |
|
8765 |
|
8766 | var node = firstChild;
|
8767 | while (node !== null) {
|
8768 | if (node.tag === SuspenseComponent) {
|
8769 | var state = node.memoizedState;
|
8770 | if (state !== null) {
|
8771 | if (node.expirationTime < renderExpirationTime) {
|
8772 | node.expirationTime = renderExpirationTime;
|
8773 | }
|
8774 | var alternate = node.alternate;
|
8775 | if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
|
8776 | alternate.expirationTime = renderExpirationTime;
|
8777 | }
|
8778 | scheduleWorkOnParentPath(node.return, renderExpirationTime);
|
8779 | }
|
8780 | } else if (node.child !== null) {
|
8781 | node.child.return = node;
|
8782 | node = node.child;
|
8783 | continue;
|
8784 | }
|
8785 | if (node === workInProgress) {
|
8786 | return;
|
8787 | }
|
8788 | while (node.sibling === null) {
|
8789 | if (node.return === null || node.return === workInProgress) {
|
8790 | return;
|
8791 | }
|
8792 | node = node.return;
|
8793 | }
|
8794 | node.sibling.return = node.return;
|
8795 | node = node.sibling;
|
8796 | }
|
8797 | }
|
8798 |
|
8799 | function findLastContentRow(firstChild) {
|
8800 |
|
8801 |
|
8802 |
|
8803 |
|
8804 |
|
8805 |
|
8806 |
|
8807 | var row = firstChild;
|
8808 | var lastContentRow = null;
|
8809 | while (row !== null) {
|
8810 | var currentRow = row.alternate;
|
8811 |
|
8812 | if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
8813 | lastContentRow = row;
|
8814 | }
|
8815 | row = row.sibling;
|
8816 | }
|
8817 | return lastContentRow;
|
8818 | }
|
8819 |
|
8820 | function validateRevealOrder(revealOrder) {
|
8821 | {
|
8822 | if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) {
|
8823 | didWarnAboutRevealOrder[revealOrder] = true;
|
8824 | if (typeof revealOrder === 'string') {
|
8825 | switch (revealOrder.toLowerCase()) {
|
8826 | case 'together':
|
8827 | case 'forwards':
|
8828 | case 'backwards':
|
8829 | {
|
8830 | warning$1(false, '"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
|
8831 | break;
|
8832 | }
|
8833 | case 'forward':
|
8834 | case 'backward':
|
8835 | {
|
8836 | warning$1(false, '"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
|
8837 | break;
|
8838 | }
|
8839 | default:
|
8840 | warning$1(false, '"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
8841 | break;
|
8842 | }
|
8843 | } else {
|
8844 | warning$1(false, '%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
8845 | }
|
8846 | }
|
8847 | }
|
8848 | }
|
8849 |
|
8850 | function validateTailOptions(tailMode, revealOrder) {
|
8851 | {
|
8852 | if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) {
|
8853 | if (tailMode !== 'collapsed' && tailMode !== 'hidden') {
|
8854 | didWarnAboutTailOptions[tailMode] = true;
|
8855 | warning$1(false, '"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode);
|
8856 | } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') {
|
8857 | didWarnAboutTailOptions[tailMode] = true;
|
8858 | warning$1(false, '<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode);
|
8859 | }
|
8860 | }
|
8861 | }
|
8862 | }
|
8863 |
|
8864 | function validateSuspenseListNestedChild(childSlot, index) {
|
8865 | {
|
8866 | var isArray = Array.isArray(childSlot);
|
8867 | var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function';
|
8868 | if (isArray || isIterable) {
|
8869 | var type = isArray ? 'array' : 'iterable';
|
8870 | warning$1(false, 'A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type);
|
8871 | return false;
|
8872 | }
|
8873 | }
|
8874 | return true;
|
8875 | }
|
8876 |
|
8877 | function validateSuspenseListChildren(children, revealOrder) {
|
8878 | {
|
8879 | if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) {
|
8880 | if (Array.isArray(children)) {
|
8881 | for (var i = 0; i < children.length; i++) {
|
8882 | if (!validateSuspenseListNestedChild(children[i], i)) {
|
8883 | return;
|
8884 | }
|
8885 | }
|
8886 | } else {
|
8887 | var iteratorFn = getIteratorFn(children);
|
8888 | if (typeof iteratorFn === 'function') {
|
8889 | var childrenIterator = iteratorFn.call(children);
|
8890 | if (childrenIterator) {
|
8891 | var step = childrenIterator.next();
|
8892 | var _i = 0;
|
8893 | for (; !step.done; step = childrenIterator.next()) {
|
8894 | if (!validateSuspenseListNestedChild(step.value, _i)) {
|
8895 | return;
|
8896 | }
|
8897 | _i++;
|
8898 | }
|
8899 | }
|
8900 | } else {
|
8901 | warning$1(false, 'A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder);
|
8902 | }
|
8903 | }
|
8904 | }
|
8905 | }
|
8906 | }
|
8907 |
|
8908 | function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
|
8909 | var renderState = workInProgress.memoizedState;
|
8910 | if (renderState === null) {
|
8911 | workInProgress.memoizedState = {
|
8912 | isBackwards: isBackwards,
|
8913 | rendering: null,
|
8914 | last: lastContentRow,
|
8915 | tail: tail,
|
8916 | tailExpiration: 0,
|
8917 | tailMode: tailMode
|
8918 | };
|
8919 | } else {
|
8920 |
|
8921 | renderState.isBackwards = isBackwards;
|
8922 | renderState.rendering = null;
|
8923 | renderState.last = lastContentRow;
|
8924 | renderState.tail = tail;
|
8925 | renderState.tailExpiration = 0;
|
8926 | renderState.tailMode = tailMode;
|
8927 | }
|
8928 | }
|
8929 |
|
8930 |
|
8931 |
|
8932 |
|
8933 |
|
8934 |
|
8935 |
|
8936 |
|
8937 | function updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime) {
|
8938 | var nextProps = workInProgress.pendingProps;
|
8939 | var revealOrder = nextProps.revealOrder;
|
8940 | var tailMode = nextProps.tail;
|
8941 | var newChildren = nextProps.children;
|
8942 |
|
8943 | validateRevealOrder(revealOrder);
|
8944 | validateTailOptions(tailMode, revealOrder);
|
8945 | validateSuspenseListChildren(newChildren, revealOrder);
|
8946 |
|
8947 | reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
8948 |
|
8949 | var suspenseContext = suspenseStackCursor.current;
|
8950 |
|
8951 | var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
8952 | if (shouldForceFallback) {
|
8953 | suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
8954 | workInProgress.effectTag |= DidCapture;
|
8955 | } else {
|
8956 | var didSuspendBefore = current$$1 !== null && (current$$1.effectTag & DidCapture) !== NoEffect;
|
8957 | if (didSuspendBefore) {
|
8958 |
|
8959 |
|
8960 |
|
8961 | propagateSuspenseContextChange(workInProgress, workInProgress.child, renderExpirationTime);
|
8962 | }
|
8963 | suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
8964 | }
|
8965 | pushSuspenseContext(workInProgress, suspenseContext);
|
8966 |
|
8967 | if ((workInProgress.mode & BatchedMode) === NoMode) {
|
8968 |
|
8969 |
|
8970 | workInProgress.memoizedState = null;
|
8971 | } else {
|
8972 | switch (revealOrder) {
|
8973 | case 'forwards':
|
8974 | {
|
8975 | var lastContentRow = findLastContentRow(workInProgress.child);
|
8976 | var tail = void 0;
|
8977 | if (lastContentRow === null) {
|
8978 |
|
8979 |
|
8980 | tail = workInProgress.child;
|
8981 | workInProgress.child = null;
|
8982 | } else {
|
8983 |
|
8984 |
|
8985 | tail = lastContentRow.sibling;
|
8986 | lastContentRow.sibling = null;
|
8987 | }
|
8988 | initSuspenseListRenderState(workInProgress, false,
|
8989 | tail, lastContentRow, tailMode);
|
8990 | break;
|
8991 | }
|
8992 | case 'backwards':
|
8993 | {
|
8994 |
|
8995 |
|
8996 |
|
8997 |
|
8998 | var _tail = null;
|
8999 | var row = workInProgress.child;
|
9000 | workInProgress.child = null;
|
9001 | while (row !== null) {
|
9002 | var currentRow = row.alternate;
|
9003 |
|
9004 | if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
9005 |
|
9006 | workInProgress.child = row;
|
9007 | break;
|
9008 | }
|
9009 | var nextRow = row.sibling;
|
9010 | row.sibling = _tail;
|
9011 | _tail = row;
|
9012 | row = nextRow;
|
9013 | }
|
9014 |
|
9015 | initSuspenseListRenderState(workInProgress, true,
|
9016 | _tail, null,
|
9017 | tailMode);
|
9018 | break;
|
9019 | }
|
9020 | case 'together':
|
9021 | {
|
9022 | initSuspenseListRenderState(workInProgress, false,
|
9023 | null,
|
9024 | null,
|
9025 | undefined);
|
9026 | break;
|
9027 | }
|
9028 | default:
|
9029 | {
|
9030 |
|
9031 |
|
9032 | workInProgress.memoizedState = null;
|
9033 | }
|
9034 | }
|
9035 | }
|
9036 | return workInProgress.child;
|
9037 | }
|
9038 |
|
9039 | function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
|
9040 | pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
9041 | var nextChildren = workInProgress.pendingProps;
|
9042 | if (current$$1 === null) {
|
9043 |
|
9044 |
|
9045 |
|
9046 |
|
9047 |
|
9048 | workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
|
9049 | } else {
|
9050 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
9051 | }
|
9052 | return workInProgress.child;
|
9053 | }
|
9054 |
|
9055 | function updateContextProvider(current$$1, workInProgress, renderExpirationTime) {
|
9056 | var providerType = workInProgress.type;
|
9057 | var context = providerType._context;
|
9058 |
|
9059 | var newProps = workInProgress.pendingProps;
|
9060 | var oldProps = workInProgress.memoizedProps;
|
9061 |
|
9062 | var newValue = newProps.value;
|
9063 |
|
9064 | {
|
9065 | var providerPropTypes = workInProgress.type.propTypes;
|
9066 |
|
9067 | if (providerPropTypes) {
|
9068 | checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
|
9069 | }
|
9070 | }
|
9071 |
|
9072 | pushProvider(workInProgress, newValue);
|
9073 |
|
9074 | if (oldProps !== null) {
|
9075 | var oldValue = oldProps.value;
|
9076 | var changedBits = calculateChangedBits(context, newValue, oldValue);
|
9077 | if (changedBits === 0) {
|
9078 |
|
9079 | if (oldProps.children === newProps.children && !hasContextChanged()) {
|
9080 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
9081 | }
|
9082 | } else {
|
9083 |
|
9084 |
|
9085 | propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
|
9086 | }
|
9087 | }
|
9088 |
|
9089 | var newChildren = newProps.children;
|
9090 | reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
9091 | return workInProgress.child;
|
9092 | }
|
9093 |
|
9094 | var hasWarnedAboutUsingContextAsConsumer = false;
|
9095 |
|
9096 | function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
|
9097 | var context = workInProgress.type;
|
9098 |
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 |
|
9105 | {
|
9106 | if (context._context === undefined) {
|
9107 |
|
9108 |
|
9109 |
|
9110 | if (context !== context.Consumer) {
|
9111 | if (!hasWarnedAboutUsingContextAsConsumer) {
|
9112 | hasWarnedAboutUsingContextAsConsumer = true;
|
9113 | warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
9114 | }
|
9115 | }
|
9116 | } else {
|
9117 | context = context._context;
|
9118 | }
|
9119 | }
|
9120 | var newProps = workInProgress.pendingProps;
|
9121 | var render = newProps.children;
|
9122 |
|
9123 | {
|
9124 | !(typeof render === 'function') ? warningWithoutStack$1(false, 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.') : void 0;
|
9125 | }
|
9126 |
|
9127 | prepareToReadContext(workInProgress, renderExpirationTime);
|
9128 | var newValue = readContext(context, newProps.unstable_observedBits);
|
9129 | var newChildren = void 0;
|
9130 | {
|
9131 | ReactCurrentOwner$2.current = workInProgress;
|
9132 | setCurrentPhase('render');
|
9133 | newChildren = render(newValue);
|
9134 | setCurrentPhase(null);
|
9135 | }
|
9136 |
|
9137 |
|
9138 | workInProgress.effectTag |= PerformedWork;
|
9139 | reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
|
9140 | return workInProgress.child;
|
9141 | }
|
9142 |
|
9143 | function updateFundamentalComponent$1(current$$1, workInProgress, renderExpirationTime) {
|
9144 | var fundamentalImpl = workInProgress.type.impl;
|
9145 | if (fundamentalImpl.reconcileChildren === false) {
|
9146 | return null;
|
9147 | }
|
9148 | var nextProps = workInProgress.pendingProps;
|
9149 | var nextChildren = nextProps.children;
|
9150 |
|
9151 | reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
|
9152 | return workInProgress.child;
|
9153 | }
|
9154 |
|
9155 | function markWorkInProgressReceivedUpdate() {
|
9156 | didReceiveUpdate = true;
|
9157 | }
|
9158 |
|
9159 | function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime) {
|
9160 | cancelWorkTimer(workInProgress);
|
9161 |
|
9162 | if (current$$1 !== null) {
|
9163 |
|
9164 | workInProgress.dependencies = current$$1.dependencies;
|
9165 | }
|
9166 |
|
9167 | if (enableProfilerTimer) {
|
9168 |
|
9169 | stopProfilerTimerIfRunning(workInProgress);
|
9170 | }
|
9171 |
|
9172 |
|
9173 | var childExpirationTime = workInProgress.childExpirationTime;
|
9174 | if (childExpirationTime < renderExpirationTime) {
|
9175 |
|
9176 |
|
9177 |
|
9178 | return null;
|
9179 | } else {
|
9180 |
|
9181 |
|
9182 | cloneChildFibers(current$$1, workInProgress);
|
9183 | return workInProgress.child;
|
9184 | }
|
9185 | }
|
9186 |
|
9187 | function remountFiber(current$$1, oldWorkInProgress, newWorkInProgress) {
|
9188 | {
|
9189 | var returnFiber = oldWorkInProgress.return;
|
9190 | if (returnFiber === null) {
|
9191 | throw new Error('Cannot swap the root fiber.');
|
9192 | }
|
9193 |
|
9194 |
|
9195 |
|
9196 | current$$1.alternate = null;
|
9197 | oldWorkInProgress.alternate = null;
|
9198 |
|
9199 |
|
9200 | newWorkInProgress.index = oldWorkInProgress.index;
|
9201 | newWorkInProgress.sibling = oldWorkInProgress.sibling;
|
9202 | newWorkInProgress.return = oldWorkInProgress.return;
|
9203 | newWorkInProgress.ref = oldWorkInProgress.ref;
|
9204 |
|
9205 |
|
9206 | if (oldWorkInProgress === returnFiber.child) {
|
9207 | returnFiber.child = newWorkInProgress;
|
9208 | } else {
|
9209 | var prevSibling = returnFiber.child;
|
9210 | if (prevSibling === null) {
|
9211 | throw new Error('Expected parent to have a child.');
|
9212 | }
|
9213 | while (prevSibling.sibling !== oldWorkInProgress) {
|
9214 | prevSibling = prevSibling.sibling;
|
9215 | if (prevSibling === null) {
|
9216 | throw new Error('Expected to find the previous sibling.');
|
9217 | }
|
9218 | }
|
9219 | prevSibling.sibling = newWorkInProgress;
|
9220 | }
|
9221 |
|
9222 |
|
9223 |
|
9224 | var last = returnFiber.lastEffect;
|
9225 | if (last !== null) {
|
9226 | last.nextEffect = current$$1;
|
9227 | returnFiber.lastEffect = current$$1;
|
9228 | } else {
|
9229 | returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
|
9230 | }
|
9231 | current$$1.nextEffect = null;
|
9232 | current$$1.effectTag = Deletion;
|
9233 |
|
9234 | newWorkInProgress.effectTag |= Placement;
|
9235 |
|
9236 |
|
9237 | return newWorkInProgress;
|
9238 | }
|
9239 | }
|
9240 |
|
9241 | function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
|
9242 | var updateExpirationTime = workInProgress.expirationTime;
|
9243 |
|
9244 | {
|
9245 | if (workInProgress._debugNeedsRemount && current$$1 !== null) {
|
9246 |
|
9247 | return remountFiber(current$$1, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.expirationTime));
|
9248 | }
|
9249 | }
|
9250 |
|
9251 | if (current$$1 !== null) {
|
9252 | var oldProps = current$$1.memoizedProps;
|
9253 | var newProps = workInProgress.pendingProps;
|
9254 |
|
9255 | if (oldProps !== newProps || hasContextChanged() || (
|
9256 |
|
9257 | workInProgress.type !== current$$1.type)) {
|
9258 |
|
9259 |
|
9260 | didReceiveUpdate = true;
|
9261 | } else if (updateExpirationTime < renderExpirationTime) {
|
9262 | didReceiveUpdate = false;
|
9263 |
|
9264 |
|
9265 |
|
9266 | switch (workInProgress.tag) {
|
9267 | case HostRoot:
|
9268 | pushHostRootContext(workInProgress);
|
9269 | resetHydrationState();
|
9270 | break;
|
9271 | case HostComponent:
|
9272 | pushHostContext(workInProgress);
|
9273 | if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(workInProgress.type, newProps)) {
|
9274 | if (enableSchedulerTracing) {
|
9275 | markSpawnedWork(Never);
|
9276 | }
|
9277 |
|
9278 | workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
|
9279 | return null;
|
9280 | }
|
9281 | break;
|
9282 | case ClassComponent:
|
9283 | {
|
9284 | var Component = workInProgress.type;
|
9285 | if (isContextProvider(Component)) {
|
9286 | pushContextProvider(workInProgress);
|
9287 | }
|
9288 | break;
|
9289 | }
|
9290 | case HostPortal:
|
9291 | pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
9292 | break;
|
9293 | case ContextProvider:
|
9294 | {
|
9295 | var newValue = workInProgress.memoizedProps.value;
|
9296 | pushProvider(workInProgress, newValue);
|
9297 | break;
|
9298 | }
|
9299 | case Profiler:
|
9300 | if (enableProfilerTimer) {
|
9301 | workInProgress.effectTag |= Update;
|
9302 | }
|
9303 | break;
|
9304 | case SuspenseComponent:
|
9305 | {
|
9306 | var state = workInProgress.memoizedState;
|
9307 | var didTimeout = state !== null;
|
9308 | if (didTimeout) {
|
9309 |
|
9310 |
|
9311 |
|
9312 | var primaryChildFragment = workInProgress.child;
|
9313 | var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
|
9314 | if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
|
9315 |
|
9316 |
|
9317 | return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
9318 | } else {
|
9319 | pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
9320 |
|
9321 |
|
9322 | var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
9323 | if (child !== null) {
|
9324 |
|
9325 |
|
9326 | return child.sibling;
|
9327 | } else {
|
9328 | return null;
|
9329 | }
|
9330 | }
|
9331 | } else {
|
9332 | pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
9333 | }
|
9334 | break;
|
9335 | }
|
9336 | case DehydratedSuspenseComponent:
|
9337 | {
|
9338 | if (enableSuspenseServerRenderer) {
|
9339 | pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
9340 |
|
9341 |
|
9342 |
|
9343 | workInProgress.effectTag |= DidCapture;
|
9344 | }
|
9345 | break;
|
9346 | }
|
9347 | case SuspenseListComponent:
|
9348 | {
|
9349 | var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
|
9350 |
|
9351 | var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
|
9352 |
|
9353 | if (didSuspendBefore) {
|
9354 | if (hasChildWork) {
|
9355 |
|
9356 |
|
9357 |
|
9358 |
|
9359 |
|
9360 | return updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime);
|
9361 | }
|
9362 |
|
9363 |
|
9364 |
|
9365 | workInProgress.effectTag |= DidCapture;
|
9366 | }
|
9367 |
|
9368 |
|
9369 |
|
9370 |
|
9371 | var renderState = workInProgress.memoizedState;
|
9372 | if (renderState !== null) {
|
9373 |
|
9374 |
|
9375 | renderState.rendering = null;
|
9376 | renderState.tail = null;
|
9377 | }
|
9378 | pushSuspenseContext(workInProgress, suspenseStackCursor.current);
|
9379 |
|
9380 | if (hasChildWork) {
|
9381 | break;
|
9382 | } else {
|
9383 |
|
9384 |
|
9385 |
|
9386 | return null;
|
9387 | }
|
9388 | }
|
9389 | }
|
9390 | return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
|
9391 | }
|
9392 | } else {
|
9393 | didReceiveUpdate = false;
|
9394 | }
|
9395 |
|
9396 |
|
9397 | workInProgress.expirationTime = NoWork;
|
9398 |
|
9399 | switch (workInProgress.tag) {
|
9400 | case IndeterminateComponent:
|
9401 | {
|
9402 | return mountIndeterminateComponent(current$$1, workInProgress, workInProgress.type, renderExpirationTime);
|
9403 | }
|
9404 | case LazyComponent:
|
9405 | {
|
9406 | var elementType = workInProgress.elementType;
|
9407 | return mountLazyComponent(current$$1, workInProgress, elementType, updateExpirationTime, renderExpirationTime);
|
9408 | }
|
9409 | case FunctionComponent:
|
9410 | {
|
9411 | var _Component = workInProgress.type;
|
9412 | var unresolvedProps = workInProgress.pendingProps;
|
9413 | var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
|
9414 | return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
|
9415 | }
|
9416 | case ClassComponent:
|
9417 | {
|
9418 | var _Component2 = workInProgress.type;
|
9419 | var _unresolvedProps = workInProgress.pendingProps;
|
9420 | var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
|
9421 | return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
|
9422 | }
|
9423 | case HostRoot:
|
9424 | return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
|
9425 | case HostComponent:
|
9426 | return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
|
9427 | case HostText:
|
9428 | return updateHostText(current$$1, workInProgress);
|
9429 | case SuspenseComponent:
|
9430 | return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
9431 | case HostPortal:
|
9432 | return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
|
9433 | case ForwardRef:
|
9434 | {
|
9435 | var type = workInProgress.type;
|
9436 | var _unresolvedProps2 = workInProgress.pendingProps;
|
9437 | var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
9438 | return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
|
9439 | }
|
9440 | case Fragment:
|
9441 | return updateFragment(current$$1, workInProgress, renderExpirationTime);
|
9442 | case Mode$1:
|
9443 | return updateMode(current$$1, workInProgress, renderExpirationTime);
|
9444 | case Profiler:
|
9445 | return updateProfiler(current$$1, workInProgress, renderExpirationTime);
|
9446 | case ContextProvider:
|
9447 | return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
|
9448 | case ContextConsumer:
|
9449 | return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
|
9450 | case MemoComponent:
|
9451 | {
|
9452 | var _type2 = workInProgress.type;
|
9453 | var _unresolvedProps3 = workInProgress.pendingProps;
|
9454 |
|
9455 | var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
|
9456 | {
|
9457 | if (workInProgress.type !== workInProgress.elementType) {
|
9458 | var outerPropTypes = _type2.propTypes;
|
9459 | if (outerPropTypes) {
|
9460 | checkPropTypes(outerPropTypes, _resolvedProps3,
|
9461 | 'prop', getComponentName(_type2), getCurrentFiberStackInDev);
|
9462 | }
|
9463 | }
|
9464 | }
|
9465 | _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
|
9466 | return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
|
9467 | }
|
9468 | case SimpleMemoComponent:
|
9469 | {
|
9470 | return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
|
9471 | }
|
9472 | case IncompleteClassComponent:
|
9473 | {
|
9474 | var _Component3 = workInProgress.type;
|
9475 | var _unresolvedProps4 = workInProgress.pendingProps;
|
9476 | var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
9477 | return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
|
9478 | }
|
9479 | case DehydratedSuspenseComponent:
|
9480 | {
|
9481 | if (enableSuspenseServerRenderer) {
|
9482 | return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
|
9483 | }
|
9484 | break;
|
9485 | }
|
9486 | case SuspenseListComponent:
|
9487 | {
|
9488 | return updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime);
|
9489 | }
|
9490 | case FundamentalComponent:
|
9491 | {
|
9492 | if (enableFundamentalAPI) {
|
9493 | return updateFundamentalComponent$1(current$$1, workInProgress, renderExpirationTime);
|
9494 | }
|
9495 | break;
|
9496 | }
|
9497 | }
|
9498 | (function () {
|
9499 | {
|
9500 | {
|
9501 | throw ReactError(Error('Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.'));
|
9502 | }
|
9503 | }
|
9504 | })();
|
9505 | }
|
9506 |
|
9507 | function createFundamentalStateInstance(currentFiber, props, impl, state) {
|
9508 | return {
|
9509 | currentFiber: currentFiber,
|
9510 | impl: impl,
|
9511 | instance: null,
|
9512 | prevProps: null,
|
9513 | props: props,
|
9514 | state: state
|
9515 | };
|
9516 | }
|
9517 |
|
9518 | var emptyObject = {};
|
9519 | var isArray$2 = Array.isArray;
|
9520 |
|
9521 | function markUpdate(workInProgress) {
|
9522 |
|
9523 |
|
9524 | workInProgress.effectTag |= Update;
|
9525 | }
|
9526 |
|
9527 | function markRef$1(workInProgress) {
|
9528 | workInProgress.effectTag |= Ref;
|
9529 | }
|
9530 |
|
9531 | var appendAllChildren = void 0;
|
9532 | var updateHostContainer = void 0;
|
9533 | var updateHostComponent$1 = void 0;
|
9534 | var updateHostText$1 = void 0;
|
9535 | if (supportsMutation) {
|
9536 |
|
9537 |
|
9538 | appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
9539 |
|
9540 |
|
9541 | var node = workInProgress.child;
|
9542 | while (node !== null) {
|
9543 | if (node.tag === HostComponent || node.tag === HostText) {
|
9544 | appendInitialChild(parent, node.stateNode);
|
9545 | } else if (node.tag === FundamentalComponent) {
|
9546 | appendInitialChild(parent, node.stateNode.instance);
|
9547 | } else if (node.tag === HostPortal) {
|
9548 |
|
9549 |
|
9550 |
|
9551 | } else if (node.child !== null) {
|
9552 | node.child.return = node;
|
9553 | node = node.child;
|
9554 | continue;
|
9555 | }
|
9556 | if (node === workInProgress) {
|
9557 | return;
|
9558 | }
|
9559 | while (node.sibling === null) {
|
9560 | if (node.return === null || node.return === workInProgress) {
|
9561 | return;
|
9562 | }
|
9563 | node = node.return;
|
9564 | }
|
9565 | node.sibling.return = node.return;
|
9566 | node = node.sibling;
|
9567 | }
|
9568 | };
|
9569 |
|
9570 | updateHostContainer = function (workInProgress) {
|
9571 |
|
9572 | };
|
9573 | updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
|
9574 |
|
9575 |
|
9576 | var oldProps = current.memoizedProps;
|
9577 | if (oldProps === newProps) {
|
9578 |
|
9579 |
|
9580 | return;
|
9581 | }
|
9582 |
|
9583 |
|
9584 |
|
9585 |
|
9586 |
|
9587 | var instance = workInProgress.stateNode;
|
9588 | var currentHostContext = getHostContext();
|
9589 |
|
9590 |
|
9591 |
|
9592 | var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
|
9593 |
|
9594 | workInProgress.updateQueue = updatePayload;
|
9595 |
|
9596 |
|
9597 | if (updatePayload) {
|
9598 | markUpdate(workInProgress);
|
9599 | }
|
9600 | };
|
9601 | updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
9602 |
|
9603 | if (oldText !== newText) {
|
9604 | markUpdate(workInProgress);
|
9605 | }
|
9606 | };
|
9607 | } else if (supportsPersistence) {
|
9608 |
|
9609 |
|
9610 | appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
9611 |
|
9612 |
|
9613 | var node = workInProgress.child;
|
9614 | while (node !== null) {
|
9615 |
|
9616 | branches: if (node.tag === HostComponent) {
|
9617 | var instance = node.stateNode;
|
9618 | if (needsVisibilityToggle && isHidden) {
|
9619 |
|
9620 | var props = node.memoizedProps;
|
9621 | var type = node.type;
|
9622 | instance = cloneHiddenInstance(instance, type, props, node);
|
9623 | }
|
9624 | appendInitialChild(parent, instance);
|
9625 | } else if (node.tag === HostText) {
|
9626 | var _instance = node.stateNode;
|
9627 | if (needsVisibilityToggle && isHidden) {
|
9628 |
|
9629 | var text = node.memoizedProps;
|
9630 | _instance = cloneHiddenTextInstance(_instance, text, node);
|
9631 | }
|
9632 | appendInitialChild(parent, _instance);
|
9633 | } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
|
9634 | var _instance2 = node.stateNode.instance;
|
9635 | if (needsVisibilityToggle && isHidden) {
|
9636 |
|
9637 | var _props = node.memoizedProps;
|
9638 | var _type = node.type;
|
9639 | _instance2 = cloneHiddenInstance(_instance2, _type, _props, node);
|
9640 | }
|
9641 | appendInitialChild(parent, _instance2);
|
9642 | } else if (node.tag === HostPortal) {
|
9643 |
|
9644 |
|
9645 |
|
9646 | } else if (node.tag === SuspenseComponent) {
|
9647 | if ((node.effectTag & Update) !== NoEffect) {
|
9648 |
|
9649 | var newIsHidden = node.memoizedState !== null;
|
9650 | if (newIsHidden) {
|
9651 | var primaryChildParent = node.child;
|
9652 | if (primaryChildParent !== null) {
|
9653 | if (primaryChildParent.child !== null) {
|
9654 | primaryChildParent.child.return = primaryChildParent;
|
9655 | appendAllChildren(parent, primaryChildParent, true, newIsHidden);
|
9656 | }
|
9657 | var fallbackChildParent = primaryChildParent.sibling;
|
9658 | if (fallbackChildParent !== null) {
|
9659 | fallbackChildParent.return = node;
|
9660 | node = fallbackChildParent;
|
9661 | continue;
|
9662 | }
|
9663 | }
|
9664 | }
|
9665 | }
|
9666 | if (node.child !== null) {
|
9667 |
|
9668 | node.child.return = node;
|
9669 | node = node.child;
|
9670 | continue;
|
9671 | }
|
9672 | } else if (node.child !== null) {
|
9673 | node.child.return = node;
|
9674 | node = node.child;
|
9675 | continue;
|
9676 | }
|
9677 |
|
9678 | node = node;
|
9679 | if (node === workInProgress) {
|
9680 | return;
|
9681 | }
|
9682 | while (node.sibling === null) {
|
9683 | if (node.return === null || node.return === workInProgress) {
|
9684 | return;
|
9685 | }
|
9686 | node = node.return;
|
9687 | }
|
9688 | node.sibling.return = node.return;
|
9689 | node = node.sibling;
|
9690 | }
|
9691 | };
|
9692 |
|
9693 |
|
9694 | var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
|
9695 |
|
9696 |
|
9697 | var node = workInProgress.child;
|
9698 | while (node !== null) {
|
9699 |
|
9700 | branches: if (node.tag === HostComponent) {
|
9701 | var instance = node.stateNode;
|
9702 | if (needsVisibilityToggle && isHidden) {
|
9703 |
|
9704 | var props = node.memoizedProps;
|
9705 | var type = node.type;
|
9706 | instance = cloneHiddenInstance(instance, type, props, node);
|
9707 | }
|
9708 | appendChildToContainerChildSet(containerChildSet, instance);
|
9709 | } else if (node.tag === HostText) {
|
9710 | var _instance3 = node.stateNode;
|
9711 | if (needsVisibilityToggle && isHidden) {
|
9712 |
|
9713 | var text = node.memoizedProps;
|
9714 | _instance3 = cloneHiddenTextInstance(_instance3, text, node);
|
9715 | }
|
9716 | appendChildToContainerChildSet(containerChildSet, _instance3);
|
9717 | } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
|
9718 | var _instance4 = node.stateNode.instance;
|
9719 | if (needsVisibilityToggle && isHidden) {
|
9720 |
|
9721 | var _props2 = node.memoizedProps;
|
9722 | var _type2 = node.type;
|
9723 | _instance4 = cloneHiddenInstance(_instance4, _type2, _props2, node);
|
9724 | }
|
9725 | appendChildToContainerChildSet(containerChildSet, _instance4);
|
9726 | } else if (node.tag === HostPortal) {
|
9727 |
|
9728 |
|
9729 |
|
9730 | } else if (node.tag === SuspenseComponent) {
|
9731 | if ((node.effectTag & Update) !== NoEffect) {
|
9732 |
|
9733 | var newIsHidden = node.memoizedState !== null;
|
9734 | if (newIsHidden) {
|
9735 | var primaryChildParent = node.child;
|
9736 | if (primaryChildParent !== null) {
|
9737 | if (primaryChildParent.child !== null) {
|
9738 | primaryChildParent.child.return = primaryChildParent;
|
9739 | appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
|
9740 | }
|
9741 | var fallbackChildParent = primaryChildParent.sibling;
|
9742 | if (fallbackChildParent !== null) {
|
9743 | fallbackChildParent.return = node;
|
9744 | node = fallbackChildParent;
|
9745 | continue;
|
9746 | }
|
9747 | }
|
9748 | }
|
9749 | }
|
9750 | if (node.child !== null) {
|
9751 |
|
9752 | node.child.return = node;
|
9753 | node = node.child;
|
9754 | continue;
|
9755 | }
|
9756 | } else if (node.child !== null) {
|
9757 | node.child.return = node;
|
9758 | node = node.child;
|
9759 | continue;
|
9760 | }
|
9761 |
|
9762 | node = node;
|
9763 | if (node === workInProgress) {
|
9764 | return;
|
9765 | }
|
9766 | while (node.sibling === null) {
|
9767 | if (node.return === null || node.return === workInProgress) {
|
9768 | return;
|
9769 | }
|
9770 | node = node.return;
|
9771 | }
|
9772 | node.sibling.return = node.return;
|
9773 | node = node.sibling;
|
9774 | }
|
9775 | };
|
9776 | updateHostContainer = function (workInProgress) {
|
9777 | var portalOrRoot = workInProgress.stateNode;
|
9778 | var childrenUnchanged = workInProgress.firstEffect === null;
|
9779 | if (childrenUnchanged) {
|
9780 |
|
9781 | } else {
|
9782 | var container = portalOrRoot.containerInfo;
|
9783 | var newChildSet = createContainerChildSet(container);
|
9784 |
|
9785 | appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
|
9786 | portalOrRoot.pendingChildren = newChildSet;
|
9787 |
|
9788 | markUpdate(workInProgress);
|
9789 | finalizeContainerChildren(container, newChildSet);
|
9790 | }
|
9791 | };
|
9792 | updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
|
9793 | var currentInstance = current.stateNode;
|
9794 | var oldProps = current.memoizedProps;
|
9795 |
|
9796 |
|
9797 | var childrenUnchanged = workInProgress.firstEffect === null;
|
9798 | if (childrenUnchanged && oldProps === newProps) {
|
9799 |
|
9800 |
|
9801 | workInProgress.stateNode = currentInstance;
|
9802 | return;
|
9803 | }
|
9804 | var recyclableInstance = workInProgress.stateNode;
|
9805 | var currentHostContext = getHostContext();
|
9806 | var updatePayload = null;
|
9807 | if (oldProps !== newProps) {
|
9808 | updatePayload = prepareUpdate(recyclableInstance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
|
9809 | }
|
9810 | if (childrenUnchanged && updatePayload === null) {
|
9811 |
|
9812 |
|
9813 | workInProgress.stateNode = currentInstance;
|
9814 | return;
|
9815 | }
|
9816 | var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance);
|
9817 | if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance, currentHostContext)) {
|
9818 | markUpdate(workInProgress);
|
9819 | }
|
9820 | workInProgress.stateNode = newInstance;
|
9821 | if (childrenUnchanged) {
|
9822 |
|
9823 |
|
9824 |
|
9825 | markUpdate(workInProgress);
|
9826 | } else {
|
9827 |
|
9828 | appendAllChildren(newInstance, workInProgress, false, false);
|
9829 | }
|
9830 | };
|
9831 | updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
9832 | if (oldText !== newText) {
|
9833 |
|
9834 | var rootContainerInstance = getRootHostContainer();
|
9835 | var currentHostContext = getHostContext();
|
9836 | workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress);
|
9837 |
|
9838 |
|
9839 | markUpdate(workInProgress);
|
9840 | }
|
9841 | };
|
9842 | } else {
|
9843 |
|
9844 | updateHostContainer = function (workInProgress) {
|
9845 |
|
9846 | };
|
9847 | updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
|
9848 |
|
9849 | };
|
9850 | updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
9851 |
|
9852 | };
|
9853 | }
|
9854 |
|
9855 | function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
9856 | switch (renderState.tailMode) {
|
9857 | case 'hidden':
|
9858 | {
|
9859 |
|
9860 |
|
9861 |
|
9862 |
|
9863 |
|
9864 | var tailNode = renderState.tail;
|
9865 | var lastTailNode = null;
|
9866 | while (tailNode !== null) {
|
9867 | if (tailNode.alternate !== null) {
|
9868 | lastTailNode = tailNode;
|
9869 | }
|
9870 | tailNode = tailNode.sibling;
|
9871 | }
|
9872 |
|
9873 |
|
9874 | if (lastTailNode === null) {
|
9875 |
|
9876 | renderState.tail = null;
|
9877 | } else {
|
9878 |
|
9879 |
|
9880 | lastTailNode.sibling = null;
|
9881 | }
|
9882 | break;
|
9883 | }
|
9884 | case 'collapsed':
|
9885 | {
|
9886 |
|
9887 |
|
9888 |
|
9889 |
|
9890 |
|
9891 | var _tailNode = renderState.tail;
|
9892 | var _lastTailNode = null;
|
9893 | while (_tailNode !== null) {
|
9894 | if (_tailNode.alternate !== null) {
|
9895 | _lastTailNode = _tailNode;
|
9896 | }
|
9897 | _tailNode = _tailNode.sibling;
|
9898 | }
|
9899 |
|
9900 |
|
9901 | if (_lastTailNode === null) {
|
9902 |
|
9903 | if (!hasRenderedATailFallback && renderState.tail !== null) {
|
9904 |
|
9905 |
|
9906 | renderState.tail.sibling = null;
|
9907 | } else {
|
9908 | renderState.tail = null;
|
9909 | }
|
9910 | } else {
|
9911 |
|
9912 |
|
9913 | _lastTailNode.sibling = null;
|
9914 | }
|
9915 | break;
|
9916 | }
|
9917 | }
|
9918 | }
|
9919 |
|
9920 | function completeWork(current, workInProgress, renderExpirationTime) {
|
9921 | var newProps = workInProgress.pendingProps;
|
9922 |
|
9923 | switch (workInProgress.tag) {
|
9924 | case IndeterminateComponent:
|
9925 | break;
|
9926 | case LazyComponent:
|
9927 | break;
|
9928 | case SimpleMemoComponent:
|
9929 | case FunctionComponent:
|
9930 | break;
|
9931 | case ClassComponent:
|
9932 | {
|
9933 | var Component = workInProgress.type;
|
9934 | if (isContextProvider(Component)) {
|
9935 | popContext(workInProgress);
|
9936 | }
|
9937 | break;
|
9938 | }
|
9939 | case HostRoot:
|
9940 | {
|
9941 | popHostContainer(workInProgress);
|
9942 | popTopLevelContextObject(workInProgress);
|
9943 | var fiberRoot = workInProgress.stateNode;
|
9944 | if (fiberRoot.pendingContext) {
|
9945 | fiberRoot.context = fiberRoot.pendingContext;
|
9946 | fiberRoot.pendingContext = null;
|
9947 | }
|
9948 | if (current === null || current.child === null) {
|
9949 |
|
9950 |
|
9951 | popHydrationState(workInProgress);
|
9952 |
|
9953 |
|
9954 | workInProgress.effectTag &= ~Placement;
|
9955 | }
|
9956 | updateHostContainer(workInProgress);
|
9957 | break;
|
9958 | }
|
9959 | case HostComponent:
|
9960 | {
|
9961 | popHostContext(workInProgress);
|
9962 | var rootContainerInstance = getRootHostContainer();
|
9963 | var type = workInProgress.type;
|
9964 | if (current !== null && workInProgress.stateNode != null) {
|
9965 | updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
|
9966 |
|
9967 | if (enableFlareAPI) {
|
9968 | var prevListeners = current.memoizedProps.listeners;
|
9969 | var nextListeners = newProps.listeners;
|
9970 | var instance = workInProgress.stateNode;
|
9971 | if (prevListeners !== nextListeners) {
|
9972 | updateEventListeners(nextListeners, instance, rootContainerInstance, workInProgress);
|
9973 | }
|
9974 | }
|
9975 |
|
9976 | if (current.ref !== workInProgress.ref) {
|
9977 | markRef$1(workInProgress);
|
9978 | }
|
9979 | } else {
|
9980 | if (!newProps) {
|
9981 | (function () {
|
9982 | if (!(workInProgress.stateNode !== null)) {
|
9983 | {
|
9984 | throw ReactError(Error('We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.'));
|
9985 | }
|
9986 | }
|
9987 | })();
|
9988 |
|
9989 | break;
|
9990 | }
|
9991 |
|
9992 | var currentHostContext = getHostContext();
|
9993 |
|
9994 |
|
9995 |
|
9996 |
|
9997 | var wasHydrated = popHydrationState(workInProgress);
|
9998 | if (wasHydrated) {
|
9999 |
|
10000 |
|
10001 | if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
|
10002 |
|
10003 |
|
10004 | markUpdate(workInProgress);
|
10005 | }
|
10006 | } else {
|
10007 | var _instance5 = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
10008 |
|
10009 | appendAllChildren(_instance5, workInProgress, false, false);
|
10010 |
|
10011 | if (enableFlareAPI) {
|
10012 | var listeners = newProps.listeners;
|
10013 | if (listeners != null) {
|
10014 | updateEventListeners(listeners, _instance5, rootContainerInstance, workInProgress);
|
10015 | }
|
10016 | }
|
10017 |
|
10018 |
|
10019 |
|
10020 |
|
10021 | if (finalizeInitialChildren(_instance5, type, newProps, rootContainerInstance, currentHostContext)) {
|
10022 | markUpdate(workInProgress);
|
10023 | }
|
10024 | workInProgress.stateNode = _instance5;
|
10025 | }
|
10026 |
|
10027 | if (workInProgress.ref !== null) {
|
10028 |
|
10029 | markRef$1(workInProgress);
|
10030 | }
|
10031 | }
|
10032 | break;
|
10033 | }
|
10034 | case HostText:
|
10035 | {
|
10036 | var newText = newProps;
|
10037 | if (current && workInProgress.stateNode != null) {
|
10038 | var oldText = current.memoizedProps;
|
10039 |
|
10040 |
|
10041 | updateHostText$1(current, workInProgress, oldText, newText);
|
10042 | } else {
|
10043 | if (typeof newText !== 'string') {
|
10044 | (function () {
|
10045 | if (!(workInProgress.stateNode !== null)) {
|
10046 | {
|
10047 | throw ReactError(Error('We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.'));
|
10048 | }
|
10049 | }
|
10050 | })();
|
10051 |
|
10052 | }
|
10053 | var _rootContainerInstance = getRootHostContainer();
|
10054 | var _currentHostContext = getHostContext();
|
10055 | var _wasHydrated = popHydrationState(workInProgress);
|
10056 | if (_wasHydrated) {
|
10057 | if (prepareToHydrateHostTextInstance(workInProgress)) {
|
10058 | markUpdate(workInProgress);
|
10059 | }
|
10060 | } else {
|
10061 | workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
|
10062 | }
|
10063 | }
|
10064 | break;
|
10065 | }
|
10066 | case ForwardRef:
|
10067 | break;
|
10068 | case SuspenseComponent:
|
10069 | {
|
10070 | popSuspenseContext(workInProgress);
|
10071 | var nextState = workInProgress.memoizedState;
|
10072 | if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
|
10073 |
|
10074 | workInProgress.expirationTime = renderExpirationTime;
|
10075 |
|
10076 | return workInProgress;
|
10077 | }
|
10078 |
|
10079 | var nextDidTimeout = nextState !== null;
|
10080 | var prevDidTimeout = false;
|
10081 | if (current === null) {
|
10082 |
|
10083 |
|
10084 |
|
10085 | popHydrationState(workInProgress);
|
10086 | } else {
|
10087 | var prevState = current.memoizedState;
|
10088 | prevDidTimeout = prevState !== null;
|
10089 | if (!nextDidTimeout && prevState !== null) {
|
10090 |
|
10091 |
|
10092 |
|
10093 | var currentFallbackChild = current.child.sibling;
|
10094 | if (currentFallbackChild !== null) {
|
10095 |
|
10096 | var first = workInProgress.firstEffect;
|
10097 | if (first !== null) {
|
10098 | workInProgress.firstEffect = currentFallbackChild;
|
10099 | currentFallbackChild.nextEffect = first;
|
10100 | } else {
|
10101 | workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
|
10102 | currentFallbackChild.nextEffect = null;
|
10103 | }
|
10104 | currentFallbackChild.effectTag = Deletion;
|
10105 | }
|
10106 | }
|
10107 | }
|
10108 |
|
10109 | if (nextDidTimeout && !prevDidTimeout) {
|
10110 |
|
10111 |
|
10112 |
|
10113 |
|
10114 |
|
10115 | if ((workInProgress.mode & BatchedMode) !== NoMode) {
|
10116 |
|
10117 |
|
10118 |
|
10119 |
|
10120 |
|
10121 |
|
10122 |
|
10123 | var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
|
10124 | if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
|
10125 |
|
10126 |
|
10127 | renderDidSuspend();
|
10128 | } else {
|
10129 |
|
10130 |
|
10131 | renderDidSuspendDelayIfPossible();
|
10132 | }
|
10133 | }
|
10134 | }
|
10135 |
|
10136 | if (supportsPersistence) {
|
10137 |
|
10138 | if (nextDidTimeout) {
|
10139 |
|
10140 |
|
10141 |
|
10142 | workInProgress.effectTag |= Update;
|
10143 | }
|
10144 | }
|
10145 | if (supportsMutation) {
|
10146 |
|
10147 | if (nextDidTimeout || prevDidTimeout) {
|
10148 |
|
10149 |
|
10150 |
|
10151 |
|
10152 |
|
10153 | workInProgress.effectTag |= Update;
|
10154 | }
|
10155 | }
|
10156 | if (enableSuspenseCallback && workInProgress.updateQueue !== null && workInProgress.memoizedProps.suspenseCallback != null) {
|
10157 |
|
10158 | workInProgress.effectTag |= Update;
|
10159 | }
|
10160 | break;
|
10161 | }
|
10162 | case Fragment:
|
10163 | break;
|
10164 | case Mode$1:
|
10165 | break;
|
10166 | case Profiler:
|
10167 | break;
|
10168 | case HostPortal:
|
10169 | popHostContainer(workInProgress);
|
10170 | updateHostContainer(workInProgress);
|
10171 | break;
|
10172 | case ContextProvider:
|
10173 |
|
10174 | popProvider(workInProgress);
|
10175 | break;
|
10176 | case ContextConsumer:
|
10177 | break;
|
10178 | case MemoComponent:
|
10179 | break;
|
10180 | case IncompleteClassComponent:
|
10181 | {
|
10182 |
|
10183 |
|
10184 | var _Component = workInProgress.type;
|
10185 | if (isContextProvider(_Component)) {
|
10186 | popContext(workInProgress);
|
10187 | }
|
10188 | break;
|
10189 | }
|
10190 | case DehydratedSuspenseComponent:
|
10191 | {
|
10192 | if (enableSuspenseServerRenderer) {
|
10193 | popSuspenseContext(workInProgress);
|
10194 | if (current === null) {
|
10195 | var _wasHydrated2 = popHydrationState(workInProgress);
|
10196 | (function () {
|
10197 | if (!_wasHydrated2) {
|
10198 | {
|
10199 | throw ReactError(Error('A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.'));
|
10200 | }
|
10201 | }
|
10202 | })();
|
10203 | if (enableSchedulerTracing) {
|
10204 | markSpawnedWork(Never);
|
10205 | }
|
10206 | skipPastDehydratedSuspenseInstance(workInProgress);
|
10207 | } else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
|
10208 |
|
10209 |
|
10210 |
|
10211 | current.alternate = null;
|
10212 | workInProgress.alternate = null;
|
10213 | workInProgress.tag = SuspenseComponent;
|
10214 | workInProgress.memoizedState = null;
|
10215 | workInProgress.stateNode = null;
|
10216 | }
|
10217 | }
|
10218 | break;
|
10219 | }
|
10220 | case SuspenseListComponent:
|
10221 | {
|
10222 | popSuspenseContext(workInProgress);
|
10223 |
|
10224 | var renderState = workInProgress.memoizedState;
|
10225 |
|
10226 | if (renderState === null) {
|
10227 |
|
10228 |
|
10229 | break;
|
10230 | }
|
10231 |
|
10232 | var didSuspendAlready = (workInProgress.effectTag & DidCapture) !== NoEffect;
|
10233 |
|
10234 | var renderedTail = renderState.rendering;
|
10235 | if (renderedTail === null) {
|
10236 |
|
10237 | if (!didSuspendAlready) {
|
10238 |
|
10239 |
|
10240 |
|
10241 |
|
10242 |
|
10243 |
|
10244 |
|
10245 |
|
10246 |
|
10247 |
|
10248 |
|
10249 | var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.effectTag & DidCapture) === NoEffect);
|
10250 | if (!cannotBeSuspended) {
|
10251 | var row = workInProgress.child;
|
10252 | while (row !== null) {
|
10253 | var suspended = findFirstSuspended(row);
|
10254 | if (suspended !== null) {
|
10255 | didSuspendAlready = true;
|
10256 | workInProgress.effectTag |= DidCapture;
|
10257 | cutOffTailIfNeeded(renderState, false);
|
10258 |
|
10259 |
|
10260 |
|
10261 |
|
10262 |
|
10263 |
|
10264 |
|
10265 |
|
10266 |
|
10267 |
|
10268 |
|
10269 |
|
10270 |
|
10271 | var newThennables = suspended.updateQueue;
|
10272 | if (newThennables !== null) {
|
10273 | workInProgress.updateQueue = newThennables;
|
10274 | workInProgress.effectTag |= Update;
|
10275 | }
|
10276 |
|
10277 |
|
10278 |
|
10279 |
|
10280 | workInProgress.firstEffect = workInProgress.lastEffect = null;
|
10281 |
|
10282 | resetChildFibers(workInProgress, renderExpirationTime);
|
10283 |
|
10284 |
|
10285 |
|
10286 | pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
|
10287 | return workInProgress.child;
|
10288 | }
|
10289 | row = row.sibling;
|
10290 | }
|
10291 | }
|
10292 | } else {
|
10293 | cutOffTailIfNeeded(renderState, false);
|
10294 | }
|
10295 |
|
10296 | } else {
|
10297 |
|
10298 | if (!didSuspendAlready) {
|
10299 | var _suspended = findFirstSuspended(renderedTail);
|
10300 | if (_suspended !== null) {
|
10301 | workInProgress.effectTag |= DidCapture;
|
10302 | didSuspendAlready = true;
|
10303 | cutOffTailIfNeeded(renderState, true);
|
10304 |
|
10305 | if (renderState.tail === null && renderState.tailMode === 'hidden') {
|
10306 |
|
10307 |
|
10308 | var _newThennables = _suspended.updateQueue;
|
10309 | if (_newThennables !== null) {
|
10310 | workInProgress.updateQueue = _newThennables;
|
10311 | workInProgress.effectTag |= Update;
|
10312 | }
|
10313 |
|
10314 |
|
10315 | var lastEffect = workInProgress.lastEffect = renderState.lastEffect;
|
10316 |
|
10317 | if (lastEffect !== null) {
|
10318 | lastEffect.nextEffect = null;
|
10319 | }
|
10320 |
|
10321 | return null;
|
10322 | }
|
10323 | } else if (now() > renderState.tailExpiration && renderExpirationTime > Never) {
|
10324 |
|
10325 |
|
10326 |
|
10327 | workInProgress.effectTag |= DidCapture;
|
10328 | didSuspendAlready = true;
|
10329 |
|
10330 | cutOffTailIfNeeded(renderState, false);
|
10331 |
|
10332 |
|
10333 |
|
10334 |
|
10335 |
|
10336 |
|
10337 |
|
10338 | var nextPriority = renderExpirationTime - 1;
|
10339 | workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority;
|
10340 | if (enableSchedulerTracing) {
|
10341 | markSpawnedWork(nextPriority);
|
10342 | }
|
10343 | }
|
10344 | }
|
10345 | if (renderState.isBackwards) {
|
10346 |
|
10347 |
|
10348 |
|
10349 |
|
10350 |
|
10351 | renderedTail.sibling = workInProgress.child;
|
10352 | workInProgress.child = renderedTail;
|
10353 | } else {
|
10354 | var previousSibling = renderState.last;
|
10355 | if (previousSibling !== null) {
|
10356 | previousSibling.sibling = renderedTail;
|
10357 | } else {
|
10358 | workInProgress.child = renderedTail;
|
10359 | }
|
10360 | renderState.last = renderedTail;
|
10361 | }
|
10362 | }
|
10363 |
|
10364 | if (renderState.tail !== null) {
|
10365 |
|
10366 | if (renderState.tailExpiration === 0) {
|
10367 |
|
10368 |
|
10369 | var TAIL_EXPIRATION_TIMEOUT_MS = 500;
|
10370 | renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS;
|
10371 | }
|
10372 |
|
10373 | var next = renderState.tail;
|
10374 | renderState.rendering = next;
|
10375 | renderState.tail = next.sibling;
|
10376 | renderState.lastEffect = workInProgress.lastEffect;
|
10377 | next.sibling = null;
|
10378 |
|
10379 |
|
10380 |
|
10381 |
|
10382 | var suspenseContext = suspenseStackCursor.current;
|
10383 | if (didSuspendAlready) {
|
10384 | suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
10385 | } else {
|
10386 | suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
10387 | }
|
10388 | pushSuspenseContext(workInProgress, suspenseContext);
|
10389 |
|
10390 | return next;
|
10391 | }
|
10392 | break;
|
10393 | }
|
10394 | case FundamentalComponent:
|
10395 | {
|
10396 | if (enableFundamentalAPI) {
|
10397 | var fundamentalImpl = workInProgress.type.impl;
|
10398 | var fundamentalInstance = workInProgress.stateNode;
|
10399 |
|
10400 | if (fundamentalInstance === null) {
|
10401 | var getInitialState = fundamentalImpl.getInitialState;
|
10402 | var fundamentalState = void 0;
|
10403 | if (getInitialState !== undefined) {
|
10404 | fundamentalState = getInitialState(newProps);
|
10405 | }
|
10406 | fundamentalInstance = workInProgress.stateNode = createFundamentalStateInstance(workInProgress, newProps, fundamentalImpl, fundamentalState || {});
|
10407 | var _instance6 = getFundamentalComponentInstance(fundamentalInstance);
|
10408 | fundamentalInstance.instance = _instance6;
|
10409 | if (fundamentalImpl.reconcileChildren === false) {
|
10410 | return null;
|
10411 | }
|
10412 | appendAllChildren(_instance6, workInProgress, false, false);
|
10413 | mountFundamentalComponent(fundamentalInstance);
|
10414 | } else {
|
10415 |
|
10416 | var prevProps = fundamentalInstance.props;
|
10417 | fundamentalInstance.prevProps = prevProps;
|
10418 | fundamentalInstance.props = newProps;
|
10419 | fundamentalInstance.currentFiber = workInProgress;
|
10420 | if (supportsPersistence) {
|
10421 | var _instance7 = cloneFundamentalInstance(fundamentalInstance);
|
10422 | fundamentalInstance.instance = _instance7;
|
10423 | appendAllChildren(_instance7, workInProgress, false, false);
|
10424 | }
|
10425 | var shouldUpdate = shouldUpdateFundamentalComponent(fundamentalInstance);
|
10426 | if (shouldUpdate) {
|
10427 | markUpdate(workInProgress);
|
10428 | }
|
10429 | }
|
10430 | }
|
10431 | break;
|
10432 | }
|
10433 | default:
|
10434 | (function () {
|
10435 | {
|
10436 | {
|
10437 | throw ReactError(Error('Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.'));
|
10438 | }
|
10439 | }
|
10440 | })();
|
10441 | }
|
10442 |
|
10443 | return null;
|
10444 | }
|
10445 |
|
10446 | function mountEventResponder(responder, responderProps, instance, rootContainerInstance, fiber, respondersMap) {
|
10447 | var responderState = emptyObject;
|
10448 | var getInitialState = responder.getInitialState;
|
10449 | if (getInitialState !== null) {
|
10450 | responderState = getInitialState(responderProps);
|
10451 | }
|
10452 | var responderInstance = createResponderInstance(responder, responderProps, responderState, instance, fiber);
|
10453 | mountResponderInstance(responder, responderInstance, responderProps, responderState, instance, rootContainerInstance);
|
10454 | respondersMap.set(responder, responderInstance);
|
10455 | }
|
10456 |
|
10457 | function updateEventListener(listener, fiber, visistedResponders, respondersMap, instance, rootContainerInstance) {
|
10458 | var responder = void 0;
|
10459 | var props = void 0;
|
10460 |
|
10461 | if (listener) {
|
10462 | responder = listener.responder;
|
10463 | props = listener.props;
|
10464 | }
|
10465 | (function () {
|
10466 | if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
|
10467 | {
|
10468 | throw ReactError(Error('An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponer().'));
|
10469 | }
|
10470 | }
|
10471 | })();
|
10472 | var listenerProps = props;
|
10473 | if (visistedResponders.has(responder)) {
|
10474 |
|
10475 | {
|
10476 | warning$1(false, 'Duplicate event responder "%s" found in event listeners. ' + 'Event listeners passed to elements cannot use the same event responder more than once.', responder.displayName);
|
10477 | }
|
10478 | return;
|
10479 | }
|
10480 | visistedResponders.add(responder);
|
10481 | var responderInstance = respondersMap.get(responder);
|
10482 |
|
10483 | if (responderInstance === undefined) {
|
10484 |
|
10485 | mountEventResponder(responder, listenerProps, instance, rootContainerInstance, fiber, respondersMap);
|
10486 | } else {
|
10487 |
|
10488 | responderInstance.props = listenerProps;
|
10489 | responderInstance.fiber = fiber;
|
10490 | }
|
10491 | }
|
10492 |
|
10493 | function updateEventListeners(listeners, instance, rootContainerInstance, fiber) {
|
10494 | var visistedResponders = new Set();
|
10495 | var dependencies = fiber.dependencies;
|
10496 | if (listeners != null) {
|
10497 | if (dependencies === null) {
|
10498 | dependencies = fiber.dependencies = {
|
10499 | expirationTime: NoWork,
|
10500 | firstContext: null,
|
10501 | responders: new Map()
|
10502 | };
|
10503 | }
|
10504 | var respondersMap = dependencies.responders;
|
10505 | if (respondersMap === null) {
|
10506 | respondersMap = new Map();
|
10507 | }
|
10508 | if (isArray$2(listeners)) {
|
10509 | for (var i = 0, length = listeners.length; i < length; i++) {
|
10510 | var listener = listeners[i];
|
10511 | updateEventListener(listener, fiber, visistedResponders, respondersMap, instance, rootContainerInstance);
|
10512 | }
|
10513 | } else {
|
10514 | updateEventListener(listeners, fiber, visistedResponders, respondersMap, instance, rootContainerInstance);
|
10515 | }
|
10516 | }
|
10517 | if (dependencies !== null) {
|
10518 | var _respondersMap = dependencies.responders;
|
10519 | if (_respondersMap !== null) {
|
10520 |
|
10521 | var mountedResponders = Array.from(_respondersMap.keys());
|
10522 | for (var _i = 0, _length = mountedResponders.length; _i < _length; _i++) {
|
10523 | var mountedResponder = mountedResponders[_i];
|
10524 | if (!visistedResponders.has(mountedResponder)) {
|
10525 | var responderInstance = _respondersMap.get(mountedResponder);
|
10526 | unmountResponderInstance(responderInstance);
|
10527 | _respondersMap.delete(mountedResponder);
|
10528 | }
|
10529 | }
|
10530 | }
|
10531 | }
|
10532 | }
|
10533 |
|
10534 | function unwindWork(workInProgress, renderExpirationTime) {
|
10535 | switch (workInProgress.tag) {
|
10536 | case ClassComponent:
|
10537 | {
|
10538 | var Component = workInProgress.type;
|
10539 | if (isContextProvider(Component)) {
|
10540 | popContext(workInProgress);
|
10541 | }
|
10542 | var effectTag = workInProgress.effectTag;
|
10543 | if (effectTag & ShouldCapture) {
|
10544 | workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
|
10545 | return workInProgress;
|
10546 | }
|
10547 | return null;
|
10548 | }
|
10549 | case HostRoot:
|
10550 | {
|
10551 | popHostContainer(workInProgress);
|
10552 | popTopLevelContextObject(workInProgress);
|
10553 | var _effectTag = workInProgress.effectTag;
|
10554 | (function () {
|
10555 | if (!((_effectTag & DidCapture) === NoEffect)) {
|
10556 | {
|
10557 | throw ReactError(Error('The root failed to unmount after an error. This is likely a bug in React. Please file an issue.'));
|
10558 | }
|
10559 | }
|
10560 | })();
|
10561 | workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
|
10562 | return workInProgress;
|
10563 | }
|
10564 | case HostComponent:
|
10565 | {
|
10566 |
|
10567 | popHostContext(workInProgress);
|
10568 | return null;
|
10569 | }
|
10570 | case SuspenseComponent:
|
10571 | {
|
10572 | popSuspenseContext(workInProgress);
|
10573 | var _effectTag2 = workInProgress.effectTag;
|
10574 | if (_effectTag2 & ShouldCapture) {
|
10575 | workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
|
10576 |
|
10577 | return workInProgress;
|
10578 | }
|
10579 | return null;
|
10580 | }
|
10581 | case DehydratedSuspenseComponent:
|
10582 | {
|
10583 | if (enableSuspenseServerRenderer) {
|
10584 |
|
10585 | popSuspenseContext(workInProgress);
|
10586 | var _effectTag3 = workInProgress.effectTag;
|
10587 | if (_effectTag3 & ShouldCapture) {
|
10588 | workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
|
10589 |
|
10590 | return workInProgress;
|
10591 | }
|
10592 | }
|
10593 | return null;
|
10594 | }
|
10595 | case SuspenseListComponent:
|
10596 | {
|
10597 | popSuspenseContext(workInProgress);
|
10598 |
|
10599 |
|
10600 | return null;
|
10601 | }
|
10602 | case HostPortal:
|
10603 | popHostContainer(workInProgress);
|
10604 | return null;
|
10605 | case ContextProvider:
|
10606 | popProvider(workInProgress);
|
10607 | return null;
|
10608 | default:
|
10609 | return null;
|
10610 | }
|
10611 | }
|
10612 |
|
10613 | function unwindInterruptedWork(interruptedWork) {
|
10614 | switch (interruptedWork.tag) {
|
10615 | case ClassComponent:
|
10616 | {
|
10617 | var childContextTypes = interruptedWork.type.childContextTypes;
|
10618 | if (childContextTypes !== null && childContextTypes !== undefined) {
|
10619 | popContext(interruptedWork);
|
10620 | }
|
10621 | break;
|
10622 | }
|
10623 | case HostRoot:
|
10624 | {
|
10625 | popHostContainer(interruptedWork);
|
10626 | popTopLevelContextObject(interruptedWork);
|
10627 | break;
|
10628 | }
|
10629 | case HostComponent:
|
10630 | {
|
10631 | popHostContext(interruptedWork);
|
10632 | break;
|
10633 | }
|
10634 | case HostPortal:
|
10635 | popHostContainer(interruptedWork);
|
10636 | break;
|
10637 | case SuspenseComponent:
|
10638 | popSuspenseContext(interruptedWork);
|
10639 | break;
|
10640 | case DehydratedSuspenseComponent:
|
10641 | if (enableSuspenseServerRenderer) {
|
10642 |
|
10643 | popSuspenseContext(interruptedWork);
|
10644 | }
|
10645 | break;
|
10646 | case SuspenseListComponent:
|
10647 | popSuspenseContext(interruptedWork);
|
10648 | break;
|
10649 | case ContextProvider:
|
10650 | popProvider(interruptedWork);
|
10651 | break;
|
10652 | default:
|
10653 | break;
|
10654 | }
|
10655 | }
|
10656 |
|
10657 | function createCapturedValue(value, source) {
|
10658 |
|
10659 |
|
10660 | return {
|
10661 | value: value,
|
10662 | source: source,
|
10663 | stack: getStackByFiberInDevAndProd(source)
|
10664 | };
|
10665 | }
|
10666 |
|
10667 | var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
|
10668 | var funcArgs = Array.prototype.slice.call(arguments, 3);
|
10669 | try {
|
10670 | func.apply(context, funcArgs);
|
10671 | } catch (error) {
|
10672 | this.onError(error);
|
10673 | }
|
10674 | };
|
10675 |
|
10676 | {
|
10677 |
|
10678 |
|
10679 |
|
10680 |
|
10681 |
|
10682 |
|
10683 |
|
10684 |
|
10685 |
|
10686 |
|
10687 |
|
10688 |
|
10689 |
|
10690 |
|
10691 |
|
10692 |
|
10693 |
|
10694 |
|
10695 |
|
10696 |
|
10697 |
|
10698 | if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
|
10699 | var fakeNode = document.createElement('react');
|
10700 |
|
10701 | var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
|
10702 |
|
10703 |
|
10704 |
|
10705 |
|
10706 | (function () {
|
10707 | if (!(typeof document !== 'undefined')) {
|
10708 | {
|
10709 | throw ReactError(Error('The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.'));
|
10710 | }
|
10711 | }
|
10712 | })();
|
10713 | var evt = document.createEvent('Event');
|
10714 |
|
10715 |
|
10716 |
|
10717 |
|
10718 |
|
10719 |
|
10720 |
|
10721 | var didError = true;
|
10722 |
|
10723 |
|
10724 |
|
10725 |
|
10726 | var windowEvent = window.event;
|
10727 |
|
10728 |
|
10729 |
|
10730 | var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
|
10731 |
|
10732 |
|
10733 |
|
10734 |
|
10735 | var funcArgs = Array.prototype.slice.call(arguments, 3);
|
10736 | function callCallback() {
|
10737 |
|
10738 |
|
10739 |
|
10740 |
|
10741 | fakeNode.removeEventListener(evtType, callCallback, false);
|
10742 |
|
10743 |
|
10744 |
|
10745 |
|
10746 |
|
10747 | if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
|
10748 | window.event = windowEvent;
|
10749 | }
|
10750 |
|
10751 | func.apply(context, funcArgs);
|
10752 | didError = false;
|
10753 | }
|
10754 |
|
10755 |
|
10756 |
|
10757 |
|
10758 |
|
10759 |
|
10760 |
|
10761 |
|
10762 |
|
10763 |
|
10764 |
|
10765 |
|
10766 | var error = void 0;
|
10767 |
|
10768 | var didSetError = false;
|
10769 | var isCrossOriginError = false;
|
10770 |
|
10771 | function handleWindowError(event) {
|
10772 | error = event.error;
|
10773 | didSetError = true;
|
10774 | if (error === null && event.colno === 0 && event.lineno === 0) {
|
10775 | isCrossOriginError = true;
|
10776 | }
|
10777 | if (event.defaultPrevented) {
|
10778 |
|
10779 |
|
10780 |
|
10781 | if (error != null && typeof error === 'object') {
|
10782 | try {
|
10783 | error._suppressLogging = true;
|
10784 | } catch (inner) {
|
10785 |
|
10786 | }
|
10787 | }
|
10788 | }
|
10789 | }
|
10790 |
|
10791 |
|
10792 | var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
|
10793 |
|
10794 |
|
10795 | window.addEventListener('error', handleWindowError);
|
10796 | fakeNode.addEventListener(evtType, callCallback, false);
|
10797 |
|
10798 |
|
10799 |
|
10800 | evt.initEvent(evtType, false, false);
|
10801 | fakeNode.dispatchEvent(evt);
|
10802 |
|
10803 | if (windowEventDescriptor) {
|
10804 | Object.defineProperty(window, 'event', windowEventDescriptor);
|
10805 | }
|
10806 |
|
10807 | if (didError) {
|
10808 | if (!didSetError) {
|
10809 |
|
10810 | error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
|
10811 | } else if (isCrossOriginError) {
|
10812 | error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
|
10813 | }
|
10814 | this.onError(error);
|
10815 | }
|
10816 |
|
10817 |
|
10818 | window.removeEventListener('error', handleWindowError);
|
10819 | };
|
10820 |
|
10821 | invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
|
10822 | }
|
10823 | }
|
10824 |
|
10825 | var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
|
10826 |
|
10827 |
|
10828 | var hasError = false;
|
10829 | var caughtError = null;
|
10830 |
|
10831 | var reporter = {
|
10832 | onError: function (error) {
|
10833 | hasError = true;
|
10834 | caughtError = error;
|
10835 | }
|
10836 | };
|
10837 |
|
10838 |
|
10839 |
|
10840 |
|
10841 |
|
10842 |
|
10843 |
|
10844 |
|
10845 |
|
10846 |
|
10847 |
|
10848 |
|
10849 |
|
10850 |
|
10851 | function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
|
10852 | hasError = false;
|
10853 | caughtError = null;
|
10854 | invokeGuardedCallbackImpl$1.apply(reporter, arguments);
|
10855 | }
|
10856 |
|
10857 |
|
10858 |
|
10859 |
|
10860 |
|
10861 |
|
10862 |
|
10863 |
|
10864 |
|
10865 |
|
10866 |
|
10867 |
|
10868 |
|
10869 |
|
10870 |
|
10871 |
|
10872 |
|
10873 |
|
10874 |
|
10875 | function hasCaughtError() {
|
10876 | return hasError;
|
10877 | }
|
10878 |
|
10879 | function clearCaughtError() {
|
10880 | if (hasError) {
|
10881 | var error = caughtError;
|
10882 | hasError = false;
|
10883 | caughtError = null;
|
10884 | return error;
|
10885 | } else {
|
10886 | (function () {
|
10887 | {
|
10888 | {
|
10889 | throw ReactError(Error('clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'));
|
10890 | }
|
10891 | }
|
10892 | })();
|
10893 | }
|
10894 | }
|
10895 |
|
10896 |
|
10897 |
|
10898 |
|
10899 | function showErrorDialog(capturedError) {
|
10900 | return true;
|
10901 | }
|
10902 |
|
10903 | function logCapturedError(capturedError) {
|
10904 | var logError = showErrorDialog(capturedError);
|
10905 |
|
10906 |
|
10907 |
|
10908 | if (logError === false) {
|
10909 | return;
|
10910 | }
|
10911 |
|
10912 | var error = capturedError.error;
|
10913 | {
|
10914 | var componentName = capturedError.componentName,
|
10915 | componentStack = capturedError.componentStack,
|
10916 | errorBoundaryName = capturedError.errorBoundaryName,
|
10917 | errorBoundaryFound = capturedError.errorBoundaryFound,
|
10918 | willRetry = capturedError.willRetry;
|
10919 |
|
10920 |
|
10921 |
|
10922 |
|
10923 |
|
10924 | if (error != null && error._suppressLogging) {
|
10925 | if (errorBoundaryFound && willRetry) {
|
10926 |
|
10927 |
|
10928 |
|
10929 | return;
|
10930 | }
|
10931 |
|
10932 |
|
10933 |
|
10934 |
|
10935 | console.error(error);
|
10936 |
|
10937 |
|
10938 | }
|
10939 |
|
10940 | var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
|
10941 |
|
10942 | var errorBoundaryMessage = void 0;
|
10943 |
|
10944 | if (errorBoundaryFound && errorBoundaryName) {
|
10945 | if (willRetry) {
|
10946 | errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
|
10947 | } else {
|
10948 | errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
|
10949 | }
|
10950 | } else {
|
10951 | errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
|
10952 | }
|
10953 | var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
|
10954 |
|
10955 |
|
10956 |
|
10957 |
|
10958 |
|
10959 | console.error(combinedMessage);
|
10960 | }
|
10961 | }
|
10962 |
|
10963 | var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
10964 | {
|
10965 | didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
10966 | }
|
10967 |
|
10968 | var PossiblyWeakSet$1 = typeof WeakSet === 'function' ? WeakSet : Set;
|
10969 |
|
10970 | function logError(boundary, errorInfo) {
|
10971 | var source = errorInfo.source;
|
10972 | var stack = errorInfo.stack;
|
10973 | if (stack === null && source !== null) {
|
10974 | stack = getStackByFiberInDevAndProd(source);
|
10975 | }
|
10976 |
|
10977 | var capturedError = {
|
10978 | componentName: source !== null ? getComponentName(source.type) : null,
|
10979 | componentStack: stack !== null ? stack : '',
|
10980 | error: errorInfo.value,
|
10981 | errorBoundary: null,
|
10982 | errorBoundaryName: null,
|
10983 | errorBoundaryFound: false,
|
10984 | willRetry: false
|
10985 | };
|
10986 |
|
10987 | if (boundary !== null && boundary.tag === ClassComponent) {
|
10988 | capturedError.errorBoundary = boundary.stateNode;
|
10989 | capturedError.errorBoundaryName = getComponentName(boundary.type);
|
10990 | capturedError.errorBoundaryFound = true;
|
10991 | capturedError.willRetry = true;
|
10992 | }
|
10993 |
|
10994 | try {
|
10995 | logCapturedError(capturedError);
|
10996 | } catch (e) {
|
10997 |
|
10998 |
|
10999 |
|
11000 |
|
11001 | setTimeout(function () {
|
11002 | throw e;
|
11003 | });
|
11004 | }
|
11005 | }
|
11006 |
|
11007 | var callComponentWillUnmountWithTimer = function (current$$1, instance) {
|
11008 | startPhaseTimer(current$$1, 'componentWillUnmount');
|
11009 | instance.props = current$$1.memoizedProps;
|
11010 | instance.state = current$$1.memoizedState;
|
11011 | instance.componentWillUnmount();
|
11012 | stopPhaseTimer();
|
11013 | };
|
11014 |
|
11015 |
|
11016 | function safelyCallComponentWillUnmount(current$$1, instance) {
|
11017 | {
|
11018 | invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current$$1, instance);
|
11019 | if (hasCaughtError()) {
|
11020 | var unmountError = clearCaughtError();
|
11021 | captureCommitPhaseError(current$$1, unmountError);
|
11022 | }
|
11023 | }
|
11024 | }
|
11025 |
|
11026 | function safelyDetachRef(current$$1) {
|
11027 | var ref = current$$1.ref;
|
11028 | if (ref !== null) {
|
11029 | if (typeof ref === 'function') {
|
11030 | {
|
11031 | invokeGuardedCallback(null, ref, null, null);
|
11032 | if (hasCaughtError()) {
|
11033 | var refError = clearCaughtError();
|
11034 | captureCommitPhaseError(current$$1, refError);
|
11035 | }
|
11036 | }
|
11037 | } else {
|
11038 | ref.current = null;
|
11039 | }
|
11040 | }
|
11041 | }
|
11042 |
|
11043 | function safelyCallDestroy(current$$1, destroy) {
|
11044 | {
|
11045 | invokeGuardedCallback(null, destroy, null);
|
11046 | if (hasCaughtError()) {
|
11047 | var error = clearCaughtError();
|
11048 | captureCommitPhaseError(current$$1, error);
|
11049 | }
|
11050 | }
|
11051 | }
|
11052 |
|
11053 | function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
|
11054 | switch (finishedWork.tag) {
|
11055 | case FunctionComponent:
|
11056 | case ForwardRef:
|
11057 | case SimpleMemoComponent:
|
11058 | {
|
11059 | commitHookEffectList(UnmountSnapshot, NoEffect$1, finishedWork);
|
11060 | return;
|
11061 | }
|
11062 | case ClassComponent:
|
11063 | {
|
11064 | if (finishedWork.effectTag & Snapshot) {
|
11065 | if (current$$1 !== null) {
|
11066 | var prevProps = current$$1.memoizedProps;
|
11067 | var prevState = current$$1.memoizedState;
|
11068 | startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
|
11069 | var instance = finishedWork.stateNode;
|
11070 |
|
11071 |
|
11072 |
|
11073 | {
|
11074 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
11075 | !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
11076 | !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
11077 | }
|
11078 | }
|
11079 | var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
|
11080 | {
|
11081 | var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
|
11082 | if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
|
11083 | didWarnSet.add(finishedWork.type);
|
11084 | warningWithoutStack$1(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
|
11085 | }
|
11086 | }
|
11087 | instance.__reactInternalSnapshotBeforeUpdate = snapshot;
|
11088 | stopPhaseTimer();
|
11089 | }
|
11090 | }
|
11091 | return;
|
11092 | }
|
11093 | case HostRoot:
|
11094 | case HostComponent:
|
11095 | case HostText:
|
11096 | case HostPortal:
|
11097 | case IncompleteClassComponent:
|
11098 |
|
11099 | return;
|
11100 | default:
|
11101 | {
|
11102 | (function () {
|
11103 | {
|
11104 | {
|
11105 | throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
|
11106 | }
|
11107 | }
|
11108 | })();
|
11109 | }
|
11110 | }
|
11111 | }
|
11112 |
|
11113 | function commitHookEffectList(unmountTag, mountTag, finishedWork) {
|
11114 | var updateQueue = finishedWork.updateQueue;
|
11115 | var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
11116 | if (lastEffect !== null) {
|
11117 | var firstEffect = lastEffect.next;
|
11118 | var effect = firstEffect;
|
11119 | do {
|
11120 | if ((effect.tag & unmountTag) !== NoEffect$1) {
|
11121 |
|
11122 | var destroy = effect.destroy;
|
11123 | effect.destroy = undefined;
|
11124 | if (destroy !== undefined) {
|
11125 | destroy();
|
11126 | }
|
11127 | }
|
11128 | if ((effect.tag & mountTag) !== NoEffect$1) {
|
11129 |
|
11130 | var create = effect.create;
|
11131 | effect.destroy = create();
|
11132 |
|
11133 | {
|
11134 | var _destroy = effect.destroy;
|
11135 | if (_destroy !== undefined && typeof _destroy !== 'function') {
|
11136 | var addendum = void 0;
|
11137 | if (_destroy === null) {
|
11138 | addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
|
11139 | } else if (typeof _destroy.then === 'function') {
|
11140 | addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + '}, [someId]); // Or [] if effect doesn\'t need props or state\n\n' + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching';
|
11141 | } else {
|
11142 | addendum = ' You returned: ' + _destroy;
|
11143 | }
|
11144 | warningWithoutStack$1(false, 'An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
|
11145 | }
|
11146 | }
|
11147 | }
|
11148 | effect = effect.next;
|
11149 | } while (effect !== firstEffect);
|
11150 | }
|
11151 | }
|
11152 |
|
11153 | function commitPassiveHookEffects(finishedWork) {
|
11154 | if ((finishedWork.effectTag & Passive) !== NoEffect) {
|
11155 | switch (finishedWork.tag) {
|
11156 | case FunctionComponent:
|
11157 | case ForwardRef:
|
11158 | case SimpleMemoComponent:
|
11159 | {
|
11160 | commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork);
|
11161 | commitHookEffectList(NoEffect$1, MountPassive, finishedWork);
|
11162 | break;
|
11163 | }
|
11164 | default:
|
11165 | break;
|
11166 | }
|
11167 | }
|
11168 | }
|
11169 |
|
11170 | function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
|
11171 | switch (finishedWork.tag) {
|
11172 | case FunctionComponent:
|
11173 | case ForwardRef:
|
11174 | case SimpleMemoComponent:
|
11175 | {
|
11176 | commitHookEffectList(UnmountLayout, MountLayout, finishedWork);
|
11177 | break;
|
11178 | }
|
11179 | case ClassComponent:
|
11180 | {
|
11181 | var instance = finishedWork.stateNode;
|
11182 | if (finishedWork.effectTag & Update) {
|
11183 | if (current$$1 === null) {
|
11184 | startPhaseTimer(finishedWork, 'componentDidMount');
|
11185 |
|
11186 |
|
11187 |
|
11188 | {
|
11189 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
11190 | !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
11191 | !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
11192 | }
|
11193 | }
|
11194 | instance.componentDidMount();
|
11195 | stopPhaseTimer();
|
11196 | } else {
|
11197 | var prevProps = finishedWork.elementType === finishedWork.type ? current$$1.memoizedProps : resolveDefaultProps(finishedWork.type, current$$1.memoizedProps);
|
11198 | var prevState = current$$1.memoizedState;
|
11199 | startPhaseTimer(finishedWork, 'componentDidUpdate');
|
11200 |
|
11201 |
|
11202 |
|
11203 | {
|
11204 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
11205 | !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
11206 | !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
11207 | }
|
11208 | }
|
11209 | instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
|
11210 | stopPhaseTimer();
|
11211 | }
|
11212 | }
|
11213 | var updateQueue = finishedWork.updateQueue;
|
11214 | if (updateQueue !== null) {
|
11215 | {
|
11216 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
11217 | !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
11218 | !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
|
11219 | }
|
11220 | }
|
11221 |
|
11222 |
|
11223 |
|
11224 | commitUpdateQueue(finishedWork, updateQueue, instance, committedExpirationTime);
|
11225 | }
|
11226 | return;
|
11227 | }
|
11228 | case HostRoot:
|
11229 | {
|
11230 | var _updateQueue = finishedWork.updateQueue;
|
11231 | if (_updateQueue !== null) {
|
11232 | var _instance = null;
|
11233 | if (finishedWork.child !== null) {
|
11234 | switch (finishedWork.child.tag) {
|
11235 | case HostComponent:
|
11236 | _instance = getPublicInstance(finishedWork.child.stateNode);
|
11237 | break;
|
11238 | case ClassComponent:
|
11239 | _instance = finishedWork.child.stateNode;
|
11240 | break;
|
11241 | }
|
11242 | }
|
11243 | commitUpdateQueue(finishedWork, _updateQueue, _instance, committedExpirationTime);
|
11244 | }
|
11245 | return;
|
11246 | }
|
11247 | case HostComponent:
|
11248 | {
|
11249 | var _instance2 = finishedWork.stateNode;
|
11250 |
|
11251 |
|
11252 |
|
11253 |
|
11254 |
|
11255 | if (current$$1 === null && finishedWork.effectTag & Update) {
|
11256 | var type = finishedWork.type;
|
11257 | var props = finishedWork.memoizedProps;
|
11258 |
|
11259 | }
|
11260 |
|
11261 | return;
|
11262 | }
|
11263 | case HostText:
|
11264 | {
|
11265 |
|
11266 | return;
|
11267 | }
|
11268 | case HostPortal:
|
11269 | {
|
11270 |
|
11271 | return;
|
11272 | }
|
11273 | case Profiler:
|
11274 | {
|
11275 | if (enableProfilerTimer) {
|
11276 | var onRender = finishedWork.memoizedProps.onRender;
|
11277 |
|
11278 | if (typeof onRender === 'function') {
|
11279 | if (enableSchedulerTracing) {
|
11280 | onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
|
11281 | } else {
|
11282 | onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime());
|
11283 | }
|
11284 | }
|
11285 | }
|
11286 | return;
|
11287 | }
|
11288 | case SuspenseComponent:
|
11289 | case SuspenseListComponent:
|
11290 | case IncompleteClassComponent:
|
11291 | case FundamentalComponent:
|
11292 | return;
|
11293 | default:
|
11294 | {
|
11295 | (function () {
|
11296 | {
|
11297 | {
|
11298 | throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
|
11299 | }
|
11300 | }
|
11301 | })();
|
11302 | }
|
11303 | }
|
11304 | }
|
11305 |
|
11306 | function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
11307 | if (supportsMutation) {
|
11308 |
|
11309 | var node = finishedWork;
|
11310 | while (true) {
|
11311 | if (node.tag === HostComponent) {
|
11312 | var instance = node.stateNode;
|
11313 | if (isHidden) {
|
11314 | hideInstance(instance);
|
11315 | } else {
|
11316 | unhideInstance(node.stateNode, node.memoizedProps);
|
11317 | }
|
11318 | } else if (node.tag === HostText) {
|
11319 | var _instance3 = node.stateNode;
|
11320 | if (isHidden) {
|
11321 |
|
11322 | } else {
|
11323 | unhideTextInstance(_instance3, node.memoizedProps);
|
11324 | }
|
11325 | } else if (node.tag === SuspenseComponent && node.memoizedState !== null) {
|
11326 |
|
11327 | var fallbackChildFragment = node.child.sibling;
|
11328 | fallbackChildFragment.return = node;
|
11329 | node = fallbackChildFragment;
|
11330 | continue;
|
11331 | } else if (node.child !== null) {
|
11332 | node.child.return = node;
|
11333 | node = node.child;
|
11334 | continue;
|
11335 | }
|
11336 | if (node === finishedWork) {
|
11337 | return;
|
11338 | }
|
11339 | while (node.sibling === null) {
|
11340 | if (node.return === null || node.return === finishedWork) {
|
11341 | return;
|
11342 | }
|
11343 | node = node.return;
|
11344 | }
|
11345 | node.sibling.return = node.return;
|
11346 | node = node.sibling;
|
11347 | }
|
11348 | }
|
11349 | }
|
11350 |
|
11351 | function commitAttachRef(finishedWork) {
|
11352 | var ref = finishedWork.ref;
|
11353 | if (ref !== null) {
|
11354 | var instance = finishedWork.stateNode;
|
11355 | var instanceToUse = void 0;
|
11356 | switch (finishedWork.tag) {
|
11357 | case HostComponent:
|
11358 | instanceToUse = getPublicInstance(instance);
|
11359 | break;
|
11360 | default:
|
11361 | instanceToUse = instance;
|
11362 | }
|
11363 | if (typeof ref === 'function') {
|
11364 | ref(instanceToUse);
|
11365 | } else {
|
11366 | {
|
11367 | if (!ref.hasOwnProperty('current')) {
|
11368 | warningWithoutStack$1(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
|
11369 | }
|
11370 | }
|
11371 |
|
11372 | ref.current = instanceToUse;
|
11373 | }
|
11374 | }
|
11375 | }
|
11376 |
|
11377 | function commitDetachRef(current$$1) {
|
11378 | var currentRef = current$$1.ref;
|
11379 | if (currentRef !== null) {
|
11380 | if (typeof currentRef === 'function') {
|
11381 | currentRef(null);
|
11382 | } else {
|
11383 | currentRef.current = null;
|
11384 | }
|
11385 | }
|
11386 | }
|
11387 |
|
11388 |
|
11389 |
|
11390 |
|
11391 | function commitUnmount(current$$1, renderPriorityLevel) {
|
11392 | onCommitUnmount(current$$1);
|
11393 |
|
11394 | switch (current$$1.tag) {
|
11395 | case FunctionComponent:
|
11396 | case ForwardRef:
|
11397 | case MemoComponent:
|
11398 | case SimpleMemoComponent:
|
11399 | {
|
11400 | var updateQueue = current$$1.updateQueue;
|
11401 | if (updateQueue !== null) {
|
11402 | var lastEffect = updateQueue.lastEffect;
|
11403 | if (lastEffect !== null) {
|
11404 | var firstEffect = lastEffect.next;
|
11405 |
|
11406 |
|
11407 |
|
11408 |
|
11409 |
|
11410 |
|
11411 |
|
11412 |
|
11413 |
|
11414 |
|
11415 |
|
11416 |
|
11417 |
|
11418 | var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
|
11419 | runWithPriority(priorityLevel, function () {
|
11420 | var effect = firstEffect;
|
11421 | do {
|
11422 | var destroy = effect.destroy;
|
11423 | if (destroy !== undefined) {
|
11424 | safelyCallDestroy(current$$1, destroy);
|
11425 | }
|
11426 | effect = effect.next;
|
11427 | } while (effect !== firstEffect);
|
11428 | });
|
11429 | }
|
11430 | }
|
11431 | break;
|
11432 | }
|
11433 | case ClassComponent:
|
11434 | {
|
11435 | safelyDetachRef(current$$1);
|
11436 | var instance = current$$1.stateNode;
|
11437 | if (typeof instance.componentWillUnmount === 'function') {
|
11438 | safelyCallComponentWillUnmount(current$$1, instance);
|
11439 | }
|
11440 | return;
|
11441 | }
|
11442 | case HostComponent:
|
11443 | {
|
11444 | if (enableFlareAPI) {
|
11445 | var dependencies = current$$1.dependencies;
|
11446 |
|
11447 | if (dependencies !== null) {
|
11448 | var respondersMap = dependencies.responders;
|
11449 | if (respondersMap !== null) {
|
11450 | var responderInstances = Array.from(respondersMap.values());
|
11451 | for (var i = 0, length = responderInstances.length; i < length; i++) {
|
11452 | var responderInstance = responderInstances[i];
|
11453 | unmountResponderInstance(responderInstance);
|
11454 | }
|
11455 | dependencies.responders = null;
|
11456 | }
|
11457 | }
|
11458 | }
|
11459 | safelyDetachRef(current$$1);
|
11460 | return;
|
11461 | }
|
11462 | case HostPortal:
|
11463 | {
|
11464 |
|
11465 |
|
11466 |
|
11467 | if (supportsMutation) {
|
11468 | unmountHostComponents(current$$1, renderPriorityLevel);
|
11469 | } else if (supportsPersistence) {
|
11470 | emptyPortalContainer(current$$1);
|
11471 | }
|
11472 | return;
|
11473 | }
|
11474 | case FundamentalComponent:
|
11475 | {
|
11476 | if (enableFundamentalAPI) {
|
11477 | var fundamentalInstance = current$$1.stateNode;
|
11478 | if (fundamentalInstance !== null) {
|
11479 | unmountFundamentalComponent(fundamentalInstance);
|
11480 | current$$1.stateNode = null;
|
11481 | }
|
11482 | }
|
11483 | }
|
11484 | }
|
11485 | }
|
11486 |
|
11487 | function commitNestedUnmounts(root, renderPriorityLevel) {
|
11488 |
|
11489 |
|
11490 |
|
11491 |
|
11492 | var node = root;
|
11493 | while (true) {
|
11494 | commitUnmount(node, renderPriorityLevel);
|
11495 |
|
11496 |
|
11497 | if (node.child !== null && (
|
11498 |
|
11499 |
|
11500 | !supportsMutation || node.tag !== HostPortal)) {
|
11501 | node.child.return = node;
|
11502 | node = node.child;
|
11503 | continue;
|
11504 | }
|
11505 | if (node === root) {
|
11506 | return;
|
11507 | }
|
11508 | while (node.sibling === null) {
|
11509 | if (node.return === null || node.return === root) {
|
11510 | return;
|
11511 | }
|
11512 | node = node.return;
|
11513 | }
|
11514 | node.sibling.return = node.return;
|
11515 | node = node.sibling;
|
11516 | }
|
11517 | }
|
11518 |
|
11519 | function detachFiber(current$$1) {
|
11520 |
|
11521 |
|
11522 |
|
11523 |
|
11524 |
|
11525 | current$$1.return = null;
|
11526 | current$$1.child = null;
|
11527 | current$$1.memoizedState = null;
|
11528 | current$$1.updateQueue = null;
|
11529 | current$$1.dependencies = null;
|
11530 | var alternate = current$$1.alternate;
|
11531 | if (alternate !== null) {
|
11532 | alternate.return = null;
|
11533 | alternate.child = null;
|
11534 | alternate.memoizedState = null;
|
11535 | alternate.updateQueue = null;
|
11536 | alternate.dependencies = null;
|
11537 | }
|
11538 | }
|
11539 |
|
11540 | function emptyPortalContainer(current$$1) {
|
11541 | if (!supportsPersistence) {
|
11542 | return;
|
11543 | }
|
11544 |
|
11545 | var portal = current$$1.stateNode;
|
11546 | var containerInfo = portal.containerInfo;
|
11547 |
|
11548 | var emptyChildSet = createContainerChildSet(containerInfo);
|
11549 | replaceContainerChildren(containerInfo, emptyChildSet);
|
11550 | }
|
11551 |
|
11552 | function commitContainer(finishedWork) {
|
11553 | if (!supportsPersistence) {
|
11554 | return;
|
11555 | }
|
11556 |
|
11557 | switch (finishedWork.tag) {
|
11558 | case ClassComponent:
|
11559 | case HostComponent:
|
11560 | case HostText:
|
11561 | case FundamentalComponent:
|
11562 | {
|
11563 | return;
|
11564 | }
|
11565 | case HostRoot:
|
11566 | case HostPortal:
|
11567 | {
|
11568 | var portalOrRoot = finishedWork.stateNode;
|
11569 | var containerInfo = portalOrRoot.containerInfo,
|
11570 | _pendingChildren = portalOrRoot.pendingChildren;
|
11571 |
|
11572 | replaceContainerChildren(containerInfo, _pendingChildren);
|
11573 | return;
|
11574 | }
|
11575 | default:
|
11576 | {
|
11577 | (function () {
|
11578 | {
|
11579 | {
|
11580 | throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
|
11581 | }
|
11582 | }
|
11583 | })();
|
11584 | }
|
11585 | }
|
11586 | }
|
11587 |
|
11588 | function getHostParentFiber(fiber) {
|
11589 | var parent = fiber.return;
|
11590 | while (parent !== null) {
|
11591 | if (isHostParent(parent)) {
|
11592 | return parent;
|
11593 | }
|
11594 | parent = parent.return;
|
11595 | }
|
11596 | (function () {
|
11597 | {
|
11598 | {
|
11599 | throw ReactError(Error('Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.'));
|
11600 | }
|
11601 | }
|
11602 | })();
|
11603 | }
|
11604 |
|
11605 | function isHostParent(fiber) {
|
11606 | return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
|
11607 | }
|
11608 |
|
11609 | function getHostSibling(fiber) {
|
11610 |
|
11611 |
|
11612 |
|
11613 | var node = fiber;
|
11614 | siblings: while (true) {
|
11615 |
|
11616 | while (node.sibling === null) {
|
11617 | if (node.return === null || isHostParent(node.return)) {
|
11618 |
|
11619 |
|
11620 | return null;
|
11621 | }
|
11622 | node = node.return;
|
11623 | }
|
11624 | node.sibling.return = node.return;
|
11625 | node = node.sibling;
|
11626 | while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedSuspenseComponent) {
|
11627 |
|
11628 |
|
11629 | if (node.effectTag & Placement) {
|
11630 |
|
11631 | continue siblings;
|
11632 | }
|
11633 |
|
11634 |
|
11635 | if (node.child === null || node.tag === HostPortal) {
|
11636 | continue siblings;
|
11637 | } else {
|
11638 | node.child.return = node;
|
11639 | node = node.child;
|
11640 | }
|
11641 | }
|
11642 |
|
11643 | if (!(node.effectTag & Placement)) {
|
11644 |
|
11645 | return node.stateNode;
|
11646 | }
|
11647 | }
|
11648 | }
|
11649 |
|
11650 | function commitPlacement(finishedWork) {
|
11651 | if (!supportsMutation) {
|
11652 | return;
|
11653 | }
|
11654 |
|
11655 |
|
11656 | var parentFiber = getHostParentFiber(finishedWork);
|
11657 |
|
11658 |
|
11659 | var parent = void 0;
|
11660 | var isContainer = void 0;
|
11661 | var parentStateNode = parentFiber.stateNode;
|
11662 | switch (parentFiber.tag) {
|
11663 | case HostComponent:
|
11664 | parent = parentStateNode;
|
11665 | isContainer = false;
|
11666 | break;
|
11667 | case HostRoot:
|
11668 | parent = parentStateNode.containerInfo;
|
11669 | isContainer = true;
|
11670 | break;
|
11671 | case HostPortal:
|
11672 | parent = parentStateNode.containerInfo;
|
11673 | isContainer = true;
|
11674 | break;
|
11675 | case FundamentalComponent:
|
11676 | if (enableFundamentalAPI) {
|
11677 | parent = parentStateNode.instance;
|
11678 | isContainer = false;
|
11679 | }
|
11680 |
|
11681 | default:
|
11682 | (function () {
|
11683 | {
|
11684 | {
|
11685 | throw ReactError(Error('Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.'));
|
11686 | }
|
11687 | }
|
11688 | })();
|
11689 | }
|
11690 | if (parentFiber.effectTag & ContentReset) {
|
11691 |
|
11692 | parentFiber.effectTag &= ~ContentReset;
|
11693 | }
|
11694 |
|
11695 | var before = getHostSibling(finishedWork);
|
11696 |
|
11697 |
|
11698 | var node = finishedWork;
|
11699 | while (true) {
|
11700 | var isHost = node.tag === HostComponent || node.tag === HostText;
|
11701 | if (isHost || node.tag === FundamentalComponent) {
|
11702 | var stateNode = isHost ? node.stateNode : node.stateNode.instance;
|
11703 | if (before) {
|
11704 | if (isContainer) {
|
11705 | insertInContainerBefore(parent, stateNode, before);
|
11706 | } else {
|
11707 | insertBefore(parent, stateNode, before);
|
11708 | }
|
11709 | } else {
|
11710 | if (isContainer) {
|
11711 | appendChildToContainer(parent, stateNode);
|
11712 | } else {
|
11713 | appendChild(parent, stateNode);
|
11714 | }
|
11715 | }
|
11716 | } else if (node.tag === HostPortal) {
|
11717 |
|
11718 |
|
11719 |
|
11720 | } else if (node.child !== null) {
|
11721 | node.child.return = node;
|
11722 | node = node.child;
|
11723 | continue;
|
11724 | }
|
11725 | if (node === finishedWork) {
|
11726 | return;
|
11727 | }
|
11728 | while (node.sibling === null) {
|
11729 | if (node.return === null || node.return === finishedWork) {
|
11730 | return;
|
11731 | }
|
11732 | node = node.return;
|
11733 | }
|
11734 | node.sibling.return = node.return;
|
11735 | node = node.sibling;
|
11736 | }
|
11737 | }
|
11738 |
|
11739 | function unmountHostComponents(current$$1, renderPriorityLevel) {
|
11740 |
|
11741 | var node = current$$1;
|
11742 |
|
11743 |
|
11744 |
|
11745 | var currentParentIsValid = false;
|
11746 |
|
11747 |
|
11748 | var currentParent = void 0;
|
11749 | var currentParentIsContainer = void 0;
|
11750 |
|
11751 | while (true) {
|
11752 | if (!currentParentIsValid) {
|
11753 | var parent = node.return;
|
11754 | findParent: while (true) {
|
11755 | (function () {
|
11756 | if (!(parent !== null)) {
|
11757 | {
|
11758 | throw ReactError(Error('Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.'));
|
11759 | }
|
11760 | }
|
11761 | })();
|
11762 | var parentStateNode = parent.stateNode;
|
11763 | switch (parent.tag) {
|
11764 | case HostComponent:
|
11765 | currentParent = parentStateNode;
|
11766 | currentParentIsContainer = false;
|
11767 | break findParent;
|
11768 | case HostRoot:
|
11769 | currentParent = parentStateNode.containerInfo;
|
11770 | currentParentIsContainer = true;
|
11771 | break findParent;
|
11772 | case HostPortal:
|
11773 | currentParent = parentStateNode.containerInfo;
|
11774 | currentParentIsContainer = true;
|
11775 | break findParent;
|
11776 | case FundamentalComponent:
|
11777 | if (enableFundamentalAPI) {
|
11778 | currentParent = parentStateNode.instance;
|
11779 | currentParentIsContainer = false;
|
11780 | }
|
11781 | }
|
11782 | parent = parent.return;
|
11783 | }
|
11784 | currentParentIsValid = true;
|
11785 | }
|
11786 |
|
11787 | if (node.tag === HostComponent || node.tag === HostText) {
|
11788 | commitNestedUnmounts(node, renderPriorityLevel);
|
11789 |
|
11790 |
|
11791 | if (currentParentIsContainer) {
|
11792 | removeChildFromContainer(currentParent, node.stateNode);
|
11793 | } else {
|
11794 | removeChild(currentParent, node.stateNode);
|
11795 | }
|
11796 |
|
11797 | } else if (node.tag === FundamentalComponent) {
|
11798 | var fundamentalNode = node.stateNode.instance;
|
11799 | commitNestedUnmounts(node, renderPriorityLevel);
|
11800 |
|
11801 |
|
11802 | if (currentParentIsContainer) {
|
11803 | removeChildFromContainer(currentParent, fundamentalNode);
|
11804 | } else {
|
11805 | removeChild(currentParent, fundamentalNode);
|
11806 | }
|
11807 | } else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
|
11808 |
|
11809 | if (currentParentIsContainer) {
|
11810 | clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
|
11811 | } else {
|
11812 | clearSuspenseBoundary(currentParent, node.stateNode);
|
11813 | }
|
11814 | } else if (node.tag === HostPortal) {
|
11815 | if (node.child !== null) {
|
11816 |
|
11817 |
|
11818 | currentParent = node.stateNode.containerInfo;
|
11819 | currentParentIsContainer = true;
|
11820 |
|
11821 | node.child.return = node;
|
11822 | node = node.child;
|
11823 | continue;
|
11824 | }
|
11825 | } else {
|
11826 | commitUnmount(node, renderPriorityLevel);
|
11827 |
|
11828 | if (node.child !== null) {
|
11829 | node.child.return = node;
|
11830 | node = node.child;
|
11831 | continue;
|
11832 | }
|
11833 | }
|
11834 | if (node === current$$1) {
|
11835 | return;
|
11836 | }
|
11837 | while (node.sibling === null) {
|
11838 | if (node.return === null || node.return === current$$1) {
|
11839 | return;
|
11840 | }
|
11841 | node = node.return;
|
11842 | if (node.tag === HostPortal) {
|
11843 |
|
11844 |
|
11845 | currentParentIsValid = false;
|
11846 | }
|
11847 | }
|
11848 | node.sibling.return = node.return;
|
11849 | node = node.sibling;
|
11850 | }
|
11851 | }
|
11852 |
|
11853 | function commitDeletion(current$$1, renderPriorityLevel) {
|
11854 | if (supportsMutation) {
|
11855 |
|
11856 |
|
11857 | unmountHostComponents(current$$1, renderPriorityLevel);
|
11858 | } else {
|
11859 |
|
11860 | commitNestedUnmounts(current$$1, renderPriorityLevel);
|
11861 | }
|
11862 | detachFiber(current$$1);
|
11863 | }
|
11864 |
|
11865 | function commitWork(current$$1, finishedWork) {
|
11866 | if (!supportsMutation) {
|
11867 | switch (finishedWork.tag) {
|
11868 | case FunctionComponent:
|
11869 | case ForwardRef:
|
11870 | case MemoComponent:
|
11871 | case SimpleMemoComponent:
|
11872 | {
|
11873 |
|
11874 |
|
11875 | commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
|
11876 | return;
|
11877 | }
|
11878 | case Profiler:
|
11879 | {
|
11880 | return;
|
11881 | }
|
11882 | case SuspenseComponent:
|
11883 | {
|
11884 | commitSuspenseComponent(finishedWork);
|
11885 | attachSuspenseRetryListeners(finishedWork);
|
11886 | return;
|
11887 | }
|
11888 | case SuspenseListComponent:
|
11889 | {
|
11890 | attachSuspenseRetryListeners(finishedWork);
|
11891 | return;
|
11892 | }
|
11893 | }
|
11894 |
|
11895 | commitContainer(finishedWork);
|
11896 | return;
|
11897 | }
|
11898 |
|
11899 | switch (finishedWork.tag) {
|
11900 | case FunctionComponent:
|
11901 | case ForwardRef:
|
11902 | case MemoComponent:
|
11903 | case SimpleMemoComponent:
|
11904 | {
|
11905 |
|
11906 |
|
11907 | commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
|
11908 | return;
|
11909 | }
|
11910 | case ClassComponent:
|
11911 | {
|
11912 | return;
|
11913 | }
|
11914 | case HostComponent:
|
11915 | {
|
11916 | var instance = finishedWork.stateNode;
|
11917 | if (instance != null) {
|
11918 |
|
11919 | var newProps = finishedWork.memoizedProps;
|
11920 |
|
11921 |
|
11922 |
|
11923 | var oldProps = current$$1 !== null ? current$$1.memoizedProps : newProps;
|
11924 | var type = finishedWork.type;
|
11925 |
|
11926 | var updatePayload = finishedWork.updateQueue;
|
11927 | finishedWork.updateQueue = null;
|
11928 | if (updatePayload !== null) {
|
11929 | commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork);
|
11930 | }
|
11931 | }
|
11932 | return;
|
11933 | }
|
11934 | case HostText:
|
11935 | {
|
11936 | (function () {
|
11937 | if (!(finishedWork.stateNode !== null)) {
|
11938 | {
|
11939 | throw ReactError(Error('This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.'));
|
11940 | }
|
11941 | }
|
11942 | })();
|
11943 | var textInstance = finishedWork.stateNode;
|
11944 | var newText = finishedWork.memoizedProps;
|
11945 |
|
11946 |
|
11947 |
|
11948 | var oldText = current$$1 !== null ? current$$1.memoizedProps : newText;
|
11949 | return;
|
11950 | }
|
11951 | case HostRoot:
|
11952 | {
|
11953 | return;
|
11954 | }
|
11955 | case Profiler:
|
11956 | {
|
11957 | return;
|
11958 | }
|
11959 | case SuspenseComponent:
|
11960 | {
|
11961 | commitSuspenseComponent(finishedWork);
|
11962 | attachSuspenseRetryListeners(finishedWork);
|
11963 | return;
|
11964 | }
|
11965 | case SuspenseListComponent:
|
11966 | {
|
11967 | attachSuspenseRetryListeners(finishedWork);
|
11968 | return;
|
11969 | }
|
11970 | case IncompleteClassComponent:
|
11971 | {
|
11972 | return;
|
11973 | }
|
11974 | case FundamentalComponent:
|
11975 | {
|
11976 | if (enableFundamentalAPI) {
|
11977 | var fundamentalInstance = finishedWork.stateNode;
|
11978 | updateFundamentalComponent(fundamentalInstance);
|
11979 | }
|
11980 | return;
|
11981 | }
|
11982 | default:
|
11983 | {
|
11984 | (function () {
|
11985 | {
|
11986 | {
|
11987 | throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
|
11988 | }
|
11989 | }
|
11990 | })();
|
11991 | }
|
11992 | }
|
11993 | }
|
11994 |
|
11995 | function commitSuspenseComponent(finishedWork) {
|
11996 | var newState = finishedWork.memoizedState;
|
11997 |
|
11998 | var newDidTimeout = void 0;
|
11999 | var primaryChildParent = finishedWork;
|
12000 | if (newState === null) {
|
12001 | newDidTimeout = false;
|
12002 | } else {
|
12003 | newDidTimeout = true;
|
12004 | primaryChildParent = finishedWork.child;
|
12005 | markCommitTimeOfFallback();
|
12006 | }
|
12007 |
|
12008 | if (supportsMutation && primaryChildParent !== null) {
|
12009 | hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
|
12010 | }
|
12011 |
|
12012 | if (enableSuspenseCallback && newState !== null) {
|
12013 | var suspenseCallback = finishedWork.memoizedProps.suspenseCallback;
|
12014 | if (typeof suspenseCallback === 'function') {
|
12015 | var thenables = finishedWork.updateQueue;
|
12016 | if (thenables !== null) {
|
12017 | suspenseCallback(new Set(thenables));
|
12018 | }
|
12019 | } else {
|
12020 | if (suspenseCallback !== undefined) {
|
12021 | warning$1(false, 'Unexpected type for suspenseCallback.');
|
12022 | }
|
12023 | }
|
12024 | }
|
12025 | }
|
12026 |
|
12027 | function attachSuspenseRetryListeners(finishedWork) {
|
12028 |
|
12029 |
|
12030 | var thenables = finishedWork.updateQueue;
|
12031 | if (thenables !== null) {
|
12032 | finishedWork.updateQueue = null;
|
12033 | var retryCache = finishedWork.stateNode;
|
12034 | if (retryCache === null) {
|
12035 | retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
|
12036 | }
|
12037 | thenables.forEach(function (thenable) {
|
12038 |
|
12039 | var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
|
12040 | if (!retryCache.has(thenable)) {
|
12041 | if (enableSchedulerTracing) {
|
12042 | retry = tracing.unstable_wrap(retry);
|
12043 | }
|
12044 | retryCache.add(thenable);
|
12045 | thenable.then(retry, retry);
|
12046 | }
|
12047 | });
|
12048 | }
|
12049 | }
|
12050 |
|
12051 | function commitResetTextContent(current$$1) {
|
12052 | if (!supportsMutation) {
|
12053 | return;
|
12054 | }
|
12055 | resetTextContent(current$$1.stateNode);
|
12056 | }
|
12057 |
|
12058 | var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
12059 | var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
12060 |
|
12061 | function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
|
12062 | var update = createUpdate(expirationTime, null);
|
12063 |
|
12064 | update.tag = CaptureUpdate;
|
12065 |
|
12066 |
|
12067 | update.payload = { element: null };
|
12068 | var error = errorInfo.value;
|
12069 | update.callback = function () {
|
12070 | onUncaughtError(error);
|
12071 | logError(fiber, errorInfo);
|
12072 | };
|
12073 | return update;
|
12074 | }
|
12075 |
|
12076 | function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
|
12077 | var update = createUpdate(expirationTime, null);
|
12078 | update.tag = CaptureUpdate;
|
12079 | var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
12080 | if (typeof getDerivedStateFromError === 'function') {
|
12081 | var error = errorInfo.value;
|
12082 | update.payload = function () {
|
12083 | logError(fiber, errorInfo);
|
12084 | return getDerivedStateFromError(error);
|
12085 | };
|
12086 | }
|
12087 |
|
12088 | var inst = fiber.stateNode;
|
12089 | if (inst !== null && typeof inst.componentDidCatch === 'function') {
|
12090 | update.callback = function callback() {
|
12091 | {
|
12092 | markFailedErrorBoundaryForHotReloading(fiber);
|
12093 | }
|
12094 | if (typeof getDerivedStateFromError !== 'function') {
|
12095 |
|
12096 |
|
12097 |
|
12098 |
|
12099 |
|
12100 | markLegacyErrorBoundaryAsFailed(this);
|
12101 |
|
12102 |
|
12103 | logError(fiber, errorInfo);
|
12104 | }
|
12105 | var error = errorInfo.value;
|
12106 | var stack = errorInfo.stack;
|
12107 | this.componentDidCatch(error, {
|
12108 | componentStack: stack !== null ? stack : ''
|
12109 | });
|
12110 | {
|
12111 | if (typeof getDerivedStateFromError !== 'function') {
|
12112 |
|
12113 |
|
12114 |
|
12115 | !(fiber.expirationTime === Sync) ? warningWithoutStack$1(false, '%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown') : void 0;
|
12116 | }
|
12117 | }
|
12118 | };
|
12119 | } else {
|
12120 | update.callback = function () {
|
12121 | markFailedErrorBoundaryForHotReloading(fiber);
|
12122 | };
|
12123 | }
|
12124 | return update;
|
12125 | }
|
12126 |
|
12127 | function attachPingListener(root, renderExpirationTime, thenable) {
|
12128 |
|
12129 |
|
12130 |
|
12131 | var pingCache = root.pingCache;
|
12132 | var threadIDs = void 0;
|
12133 | if (pingCache === null) {
|
12134 | pingCache = root.pingCache = new PossiblyWeakMap();
|
12135 | threadIDs = new Set();
|
12136 | pingCache.set(thenable, threadIDs);
|
12137 | } else {
|
12138 | threadIDs = pingCache.get(thenable);
|
12139 | if (threadIDs === undefined) {
|
12140 | threadIDs = new Set();
|
12141 | pingCache.set(thenable, threadIDs);
|
12142 | }
|
12143 | }
|
12144 | if (!threadIDs.has(renderExpirationTime)) {
|
12145 |
|
12146 | threadIDs.add(renderExpirationTime);
|
12147 | var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
|
12148 | if (enableSchedulerTracing) {
|
12149 | ping = tracing.unstable_wrap(ping);
|
12150 | }
|
12151 | thenable.then(ping, ping);
|
12152 | }
|
12153 | }
|
12154 |
|
12155 | function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
|
12156 |
|
12157 | sourceFiber.effectTag |= Incomplete;
|
12158 |
|
12159 | sourceFiber.firstEffect = sourceFiber.lastEffect = null;
|
12160 |
|
12161 | if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
|
12162 |
|
12163 | var thenable = value;
|
12164 |
|
12165 | checkForWrongSuspensePriorityInDEV(sourceFiber);
|
12166 |
|
12167 | var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext);
|
12168 |
|
12169 |
|
12170 | var _workInProgress = returnFiber;
|
12171 | do {
|
12172 | if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) {
|
12173 |
|
12174 |
|
12175 |
|
12176 | var thenables = _workInProgress.updateQueue;
|
12177 | if (thenables === null) {
|
12178 | var updateQueue = new Set();
|
12179 | updateQueue.add(thenable);
|
12180 | _workInProgress.updateQueue = updateQueue;
|
12181 | } else {
|
12182 | thenables.add(thenable);
|
12183 | }
|
12184 |
|
12185 |
|
12186 |
|
12187 |
|
12188 |
|
12189 |
|
12190 |
|
12191 |
|
12192 |
|
12193 | if ((_workInProgress.mode & BatchedMode) === NoMode) {
|
12194 | _workInProgress.effectTag |= DidCapture;
|
12195 |
|
12196 |
|
12197 |
|
12198 |
|
12199 | sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
|
12200 |
|
12201 | if (sourceFiber.tag === ClassComponent) {
|
12202 | var currentSourceFiber = sourceFiber.alternate;
|
12203 | if (currentSourceFiber === null) {
|
12204 |
|
12205 |
|
12206 |
|
12207 | sourceFiber.tag = IncompleteClassComponent;
|
12208 | } else {
|
12209 |
|
12210 |
|
12211 |
|
12212 | var update = createUpdate(Sync, null);
|
12213 | update.tag = ForceUpdate;
|
12214 | enqueueUpdate(sourceFiber, update);
|
12215 | }
|
12216 | }
|
12217 |
|
12218 |
|
12219 |
|
12220 | sourceFiber.expirationTime = Sync;
|
12221 |
|
12222 |
|
12223 | return;
|
12224 | }
|
12225 |
|
12226 |
|
12227 |
|
12228 |
|
12229 |
|
12230 |
|
12231 |
|
12232 |
|
12233 |
|
12234 |
|
12235 |
|
12236 |
|
12237 |
|
12238 |
|
12239 |
|
12240 |
|
12241 |
|
12242 |
|
12243 |
|
12244 |
|
12245 |
|
12246 |
|
12247 |
|
12248 |
|
12249 |
|
12250 |
|
12251 |
|
12252 |
|
12253 |
|
12254 |
|
12255 |
|
12256 |
|
12257 |
|
12258 |
|
12259 |
|
12260 |
|
12261 |
|
12262 |
|
12263 |
|
12264 |
|
12265 |
|
12266 |
|
12267 |
|
12268 | attachPingListener(root, renderExpirationTime, thenable);
|
12269 |
|
12270 | _workInProgress.effectTag |= ShouldCapture;
|
12271 | _workInProgress.expirationTime = renderExpirationTime;
|
12272 |
|
12273 | return;
|
12274 | } else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
|
12275 | attachPingListener(root, renderExpirationTime, thenable);
|
12276 |
|
12277 |
|
12278 | var retryCache = _workInProgress.memoizedState;
|
12279 | if (retryCache === null) {
|
12280 | retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
|
12281 | var current$$1 = _workInProgress.alternate;
|
12282 | (function () {
|
12283 | if (!current$$1) {
|
12284 | {
|
12285 | throw ReactError(Error('A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.'));
|
12286 | }
|
12287 | }
|
12288 | })();
|
12289 | current$$1.memoizedState = retryCache;
|
12290 | }
|
12291 |
|
12292 | if (!retryCache.has(thenable)) {
|
12293 | retryCache.add(thenable);
|
12294 | var retry = resolveRetryThenable.bind(null, _workInProgress, thenable);
|
12295 | if (enableSchedulerTracing) {
|
12296 | retry = tracing.unstable_wrap(retry);
|
12297 | }
|
12298 | thenable.then(retry, retry);
|
12299 | }
|
12300 | _workInProgress.effectTag |= ShouldCapture;
|
12301 | _workInProgress.expirationTime = renderExpirationTime;
|
12302 | return;
|
12303 | }
|
12304 |
|
12305 |
|
12306 | _workInProgress = _workInProgress.return;
|
12307 | } while (_workInProgress !== null);
|
12308 |
|
12309 |
|
12310 | value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.' + getStackByFiberInDevAndProd(sourceFiber));
|
12311 | }
|
12312 |
|
12313 |
|
12314 |
|
12315 |
|
12316 | renderDidError();
|
12317 | value = createCapturedValue(value, sourceFiber);
|
12318 | var workInProgress = returnFiber;
|
12319 | do {
|
12320 | switch (workInProgress.tag) {
|
12321 | case HostRoot:
|
12322 | {
|
12323 | var _errorInfo = value;
|
12324 | workInProgress.effectTag |= ShouldCapture;
|
12325 | workInProgress.expirationTime = renderExpirationTime;
|
12326 | var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
|
12327 | enqueueCapturedUpdate(workInProgress, _update);
|
12328 | return;
|
12329 | }
|
12330 | case ClassComponent:
|
12331 |
|
12332 | var errorInfo = value;
|
12333 | var ctor = workInProgress.type;
|
12334 | var instance = workInProgress.stateNode;
|
12335 | if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
12336 | workInProgress.effectTag |= ShouldCapture;
|
12337 | workInProgress.expirationTime = renderExpirationTime;
|
12338 |
|
12339 | var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
|
12340 | enqueueCapturedUpdate(workInProgress, _update2);
|
12341 | return;
|
12342 | }
|
12343 | break;
|
12344 | default:
|
12345 | break;
|
12346 | }
|
12347 | workInProgress = workInProgress.return;
|
12348 | } while (workInProgress !== null);
|
12349 | }
|
12350 |
|
12351 |
|
12352 |
|
12353 | var ceil = Math.ceil;
|
12354 |
|
12355 | var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
12356 | var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
12357 | var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
|
12358 |
|
12359 |
|
12360 | var NoContext = 0;
|
12361 | var BatchedContext = 1;
|
12362 | var DiscreteEventContext = 4;
|
12363 | var LegacyUnbatchedContext = 8;
|
12364 | var RenderContext = 16;
|
12365 | var CommitContext = 32;
|
12366 |
|
12367 | var RootIncomplete = 0;
|
12368 | var RootErrored = 1;
|
12369 | var RootSuspended = 2;
|
12370 | var RootSuspendedWithDelay = 3;
|
12371 | var RootCompleted = 4;
|
12372 |
|
12373 |
|
12374 | var executionContext = NoContext;
|
12375 |
|
12376 | var workInProgressRoot = null;
|
12377 |
|
12378 | var workInProgress = null;
|
12379 |
|
12380 | var renderExpirationTime = NoWork;
|
12381 |
|
12382 | var workInProgressRootExitStatus = RootIncomplete;
|
12383 |
|
12384 |
|
12385 |
|
12386 |
|
12387 | var workInProgressRootLatestProcessedExpirationTime = Sync;
|
12388 | var workInProgressRootLatestSuspenseTimeout = Sync;
|
12389 | var workInProgressRootCanSuspendUsingConfig = null;
|
12390 |
|
12391 |
|
12392 |
|
12393 | var workInProgressRootHasPendingPing = false;
|
12394 |
|
12395 |
|
12396 | var globalMostRecentFallbackTime = 0;
|
12397 | var FALLBACK_THROTTLE_MS = 500;
|
12398 |
|
12399 | var nextEffect = null;
|
12400 | var hasUncaughtError = false;
|
12401 | var firstUncaughtError = null;
|
12402 | var legacyErrorBoundariesThatAlreadyFailed = null;
|
12403 |
|
12404 | var rootDoesHavePassiveEffects = false;
|
12405 | var rootWithPendingPassiveEffects = null;
|
12406 | var pendingPassiveEffectsRenderPriority = NoPriority;
|
12407 | var pendingPassiveEffectsExpirationTime = NoWork;
|
12408 |
|
12409 | var rootsWithPendingDiscreteUpdates = null;
|
12410 |
|
12411 |
|
12412 | var NESTED_UPDATE_LIMIT = 50;
|
12413 | var nestedUpdateCount = 0;
|
12414 | var rootWithNestedUpdates = null;
|
12415 |
|
12416 | var NESTED_PASSIVE_UPDATE_LIMIT = 50;
|
12417 | var nestedPassiveUpdateCount = 0;
|
12418 |
|
12419 | var interruptedBy = null;
|
12420 |
|
12421 |
|
12422 |
|
12423 |
|
12424 |
|
12425 | var spawnedWorkDuringRender = null;
|
12426 |
|
12427 |
|
12428 |
|
12429 |
|
12430 |
|
12431 |
|
12432 |
|
12433 |
|
12434 |
|
12435 | var currentEventTime = NoWork;
|
12436 |
|
12437 | function requestCurrentTime() {
|
12438 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
12439 |
|
12440 | return msToExpirationTime(now());
|
12441 | }
|
12442 |
|
12443 | if (currentEventTime !== NoWork) {
|
12444 |
|
12445 | return currentEventTime;
|
12446 | }
|
12447 |
|
12448 | currentEventTime = msToExpirationTime(now());
|
12449 | return currentEventTime;
|
12450 | }
|
12451 |
|
12452 | function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
|
12453 | var mode = fiber.mode;
|
12454 | if ((mode & BatchedMode) === NoMode) {
|
12455 | return Sync;
|
12456 | }
|
12457 |
|
12458 | var priorityLevel = getCurrentPriorityLevel();
|
12459 | if ((mode & ConcurrentMode) === NoMode) {
|
12460 | return priorityLevel === ImmediatePriority ? Sync : Batched;
|
12461 | }
|
12462 |
|
12463 | if ((executionContext & RenderContext) !== NoContext) {
|
12464 |
|
12465 | return renderExpirationTime;
|
12466 | }
|
12467 |
|
12468 | var expirationTime = void 0;
|
12469 | if (suspenseConfig !== null) {
|
12470 |
|
12471 | expirationTime = computeSuspenseExpiration(currentTime, suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
|
12472 | } else {
|
12473 |
|
12474 | switch (priorityLevel) {
|
12475 | case ImmediatePriority:
|
12476 | expirationTime = Sync;
|
12477 | break;
|
12478 | case UserBlockingPriority:
|
12479 |
|
12480 | expirationTime = computeInteractiveExpiration(currentTime);
|
12481 | break;
|
12482 | case NormalPriority:
|
12483 | case LowPriority:
|
12484 |
|
12485 |
|
12486 | expirationTime = computeAsyncExpiration(currentTime);
|
12487 | break;
|
12488 | case IdlePriority:
|
12489 | expirationTime = Never;
|
12490 | break;
|
12491 | default:
|
12492 | (function () {
|
12493 | {
|
12494 | {
|
12495 | throw ReactError(Error('Expected a valid priority level'));
|
12496 | }
|
12497 | }
|
12498 | })();
|
12499 | }
|
12500 | }
|
12501 |
|
12502 |
|
12503 |
|
12504 |
|
12505 |
|
12506 |
|
12507 | if (workInProgressRoot !== null && expirationTime === renderExpirationTime) {
|
12508 |
|
12509 | expirationTime -= 1;
|
12510 | }
|
12511 |
|
12512 | return expirationTime;
|
12513 | }
|
12514 |
|
12515 |
|
12516 |
|
12517 | function scheduleUpdateOnFiber(fiber, expirationTime) {
|
12518 | checkForNestedUpdates();
|
12519 | warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
|
12520 |
|
12521 | var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime);
|
12522 | if (root === null) {
|
12523 | warnAboutUpdateOnUnmountedFiberInDEV(fiber);
|
12524 | return;
|
12525 | }
|
12526 |
|
12527 | root.pingTime = NoWork;
|
12528 |
|
12529 | checkForInterruption(fiber, expirationTime);
|
12530 | recordScheduleUpdate();
|
12531 |
|
12532 |
|
12533 |
|
12534 | var priorityLevel = getCurrentPriorityLevel();
|
12535 |
|
12536 | if (expirationTime === Sync) {
|
12537 | if (
|
12538 |
|
12539 | (executionContext & LegacyUnbatchedContext) !== NoContext &&
|
12540 |
|
12541 | (executionContext & (RenderContext | CommitContext)) === NoContext) {
|
12542 |
|
12543 | schedulePendingInteractions(root, expirationTime);
|
12544 |
|
12545 |
|
12546 |
|
12547 |
|
12548 | var callback = renderRoot(root, Sync, true);
|
12549 | while (callback !== null) {
|
12550 | callback = callback(true);
|
12551 | }
|
12552 | } else {
|
12553 | scheduleCallbackForRoot(root, ImmediatePriority, Sync);
|
12554 | if (executionContext === NoContext) {
|
12555 |
|
12556 |
|
12557 |
|
12558 |
|
12559 |
|
12560 | flushSyncCallbackQueue();
|
12561 | }
|
12562 | }
|
12563 | } else {
|
12564 | scheduleCallbackForRoot(root, priorityLevel, expirationTime);
|
12565 | }
|
12566 |
|
12567 | if ((executionContext & DiscreteEventContext) !== NoContext && (
|
12568 |
|
12569 |
|
12570 | priorityLevel === UserBlockingPriority || priorityLevel === ImmediatePriority)) {
|
12571 |
|
12572 |
|
12573 | if (rootsWithPendingDiscreteUpdates === null) {
|
12574 | rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]);
|
12575 | } else {
|
12576 | var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root);
|
12577 | if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) {
|
12578 | rootsWithPendingDiscreteUpdates.set(root, expirationTime);
|
12579 | }
|
12580 | }
|
12581 | }
|
12582 | }
|
12583 | var scheduleWork = scheduleUpdateOnFiber;
|
12584 |
|
12585 |
|
12586 |
|
12587 |
|
12588 |
|
12589 | function markUpdateTimeFromFiberToRoot(fiber, expirationTime) {
|
12590 |
|
12591 | if (fiber.expirationTime < expirationTime) {
|
12592 | fiber.expirationTime = expirationTime;
|
12593 | }
|
12594 | var alternate = fiber.alternate;
|
12595 | if (alternate !== null && alternate.expirationTime < expirationTime) {
|
12596 | alternate.expirationTime = expirationTime;
|
12597 | }
|
12598 |
|
12599 | var node = fiber.return;
|
12600 | var root = null;
|
12601 | if (node === null && fiber.tag === HostRoot) {
|
12602 | root = fiber.stateNode;
|
12603 | } else {
|
12604 | while (node !== null) {
|
12605 | alternate = node.alternate;
|
12606 | if (node.childExpirationTime < expirationTime) {
|
12607 | node.childExpirationTime = expirationTime;
|
12608 | if (alternate !== null && alternate.childExpirationTime < expirationTime) {
|
12609 | alternate.childExpirationTime = expirationTime;
|
12610 | }
|
12611 | } else if (alternate !== null && alternate.childExpirationTime < expirationTime) {
|
12612 | alternate.childExpirationTime = expirationTime;
|
12613 | }
|
12614 | if (node.return === null && node.tag === HostRoot) {
|
12615 | root = node.stateNode;
|
12616 | break;
|
12617 | }
|
12618 | node = node.return;
|
12619 | }
|
12620 | }
|
12621 |
|
12622 | if (root !== null) {
|
12623 |
|
12624 | var firstPendingTime = root.firstPendingTime;
|
12625 | if (expirationTime > firstPendingTime) {
|
12626 | root.firstPendingTime = expirationTime;
|
12627 | }
|
12628 | var lastPendingTime = root.lastPendingTime;
|
12629 | if (lastPendingTime === NoWork || expirationTime < lastPendingTime) {
|
12630 | root.lastPendingTime = expirationTime;
|
12631 | }
|
12632 | }
|
12633 |
|
12634 | return root;
|
12635 | }
|
12636 |
|
12637 |
|
12638 |
|
12639 |
|
12640 |
|
12641 |
|
12642 |
|
12643 |
|
12644 |
|
12645 | function scheduleCallbackForRoot(root, priorityLevel, expirationTime) {
|
12646 | var existingCallbackExpirationTime = root.callbackExpirationTime;
|
12647 | if (existingCallbackExpirationTime < expirationTime) {
|
12648 |
|
12649 | var existingCallbackNode = root.callbackNode;
|
12650 | if (existingCallbackNode !== null) {
|
12651 | cancelCallback(existingCallbackNode);
|
12652 | }
|
12653 | root.callbackExpirationTime = expirationTime;
|
12654 |
|
12655 | if (expirationTime === Sync) {
|
12656 |
|
12657 | root.callbackNode = scheduleSyncCallback(runRootCallback.bind(null, root, renderRoot.bind(null, root, expirationTime)));
|
12658 | } else {
|
12659 | var options = null;
|
12660 | if (!disableSchedulerTimeoutBasedOnReactExpirationTime && expirationTime !== Never) {
|
12661 | var timeout = expirationTimeToMs(expirationTime) - now();
|
12662 | options = { timeout: timeout };
|
12663 | }
|
12664 |
|
12665 | root.callbackNode = scheduleCallback(priorityLevel, runRootCallback.bind(null, root, renderRoot.bind(null, root, expirationTime)), options);
|
12666 | if (enableUserTimingAPI && expirationTime !== Sync && (executionContext & (RenderContext | CommitContext)) === NoContext) {
|
12667 |
|
12668 |
|
12669 |
|
12670 | startRequestCallbackTimer();
|
12671 | }
|
12672 | }
|
12673 | }
|
12674 |
|
12675 |
|
12676 | schedulePendingInteractions(root, expirationTime);
|
12677 | }
|
12678 |
|
12679 | function runRootCallback(root, callback, isSync) {
|
12680 | var prevCallbackNode = root.callbackNode;
|
12681 | var continuation = null;
|
12682 | try {
|
12683 | continuation = callback(isSync);
|
12684 | if (continuation !== null) {
|
12685 | return runRootCallback.bind(null, root, continuation);
|
12686 | } else {
|
12687 | return null;
|
12688 | }
|
12689 | } finally {
|
12690 |
|
12691 |
|
12692 |
|
12693 |
|
12694 | if (continuation === null && prevCallbackNode === root.callbackNode) {
|
12695 | root.callbackNode = null;
|
12696 | root.callbackExpirationTime = NoWork;
|
12697 | }
|
12698 | }
|
12699 | }
|
12700 |
|
12701 |
|
12702 |
|
12703 |
|
12704 |
|
12705 | function resolveLocksOnRoot(root, expirationTime) {
|
12706 | var firstBatch = root.firstBatch;
|
12707 | if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
|
12708 | scheduleCallback(NormalPriority, function () {
|
12709 | firstBatch._onComplete();
|
12710 | return null;
|
12711 | });
|
12712 | return true;
|
12713 | } else {
|
12714 | return false;
|
12715 | }
|
12716 | }
|
12717 |
|
12718 |
|
12719 |
|
12720 |
|
12721 |
|
12722 |
|
12723 |
|
12724 |
|
12725 |
|
12726 |
|
12727 |
|
12728 |
|
12729 |
|
12730 | function flushSync(fn, a) {
|
12731 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
12732 | (function () {
|
12733 | {
|
12734 | {
|
12735 | throw ReactError(Error('flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.'));
|
12736 | }
|
12737 | }
|
12738 | })();
|
12739 | }
|
12740 | var prevExecutionContext = executionContext;
|
12741 | executionContext |= BatchedContext;
|
12742 | try {
|
12743 | return runWithPriority(ImmediatePriority, fn.bind(null, a));
|
12744 | } finally {
|
12745 | executionContext = prevExecutionContext;
|
12746 |
|
12747 |
|
12748 |
|
12749 | flushSyncCallbackQueue();
|
12750 | }
|
12751 | }
|
12752 |
|
12753 |
|
12754 |
|
12755 | function prepareFreshStack(root, expirationTime) {
|
12756 | root.finishedWork = null;
|
12757 | root.finishedExpirationTime = NoWork;
|
12758 |
|
12759 | var timeoutHandle = root.timeoutHandle;
|
12760 | if (timeoutHandle !== noTimeout) {
|
12761 |
|
12762 |
|
12763 | root.timeoutHandle = noTimeout;
|
12764 |
|
12765 | cancelTimeout(timeoutHandle);
|
12766 | }
|
12767 |
|
12768 | if (workInProgress !== null) {
|
12769 | var interruptedWork = workInProgress.return;
|
12770 | while (interruptedWork !== null) {
|
12771 | unwindInterruptedWork(interruptedWork);
|
12772 | interruptedWork = interruptedWork.return;
|
12773 | }
|
12774 | }
|
12775 | workInProgressRoot = root;
|
12776 | workInProgress = createWorkInProgress(root.current, null, expirationTime);
|
12777 | renderExpirationTime = expirationTime;
|
12778 | workInProgressRootExitStatus = RootIncomplete;
|
12779 | workInProgressRootLatestProcessedExpirationTime = Sync;
|
12780 | workInProgressRootLatestSuspenseTimeout = Sync;
|
12781 | workInProgressRootCanSuspendUsingConfig = null;
|
12782 | workInProgressRootHasPendingPing = false;
|
12783 |
|
12784 | if (enableSchedulerTracing) {
|
12785 | spawnedWorkDuringRender = null;
|
12786 | }
|
12787 |
|
12788 | {
|
12789 | ReactStrictModeWarnings.discardPendingWarnings();
|
12790 | componentsThatTriggeredHighPriSuspend = null;
|
12791 | }
|
12792 | }
|
12793 |
|
12794 | function renderRoot(root, expirationTime, isSync) {
|
12795 | (function () {
|
12796 | if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
12797 | {
|
12798 | throw ReactError(Error('Should not already be working.'));
|
12799 | }
|
12800 | }
|
12801 | })();
|
12802 |
|
12803 | if (enableUserTimingAPI && expirationTime !== Sync) {
|
12804 | var didExpire = isSync;
|
12805 | stopRequestCallbackTimer(didExpire);
|
12806 | }
|
12807 |
|
12808 | if (root.firstPendingTime < expirationTime) {
|
12809 |
|
12810 |
|
12811 |
|
12812 | return null;
|
12813 | }
|
12814 |
|
12815 | if (isSync && root.finishedExpirationTime === expirationTime) {
|
12816 |
|
12817 |
|
12818 |
|
12819 | return commitRoot.bind(null, root);
|
12820 | }
|
12821 |
|
12822 | flushPassiveEffects();
|
12823 |
|
12824 |
|
12825 |
|
12826 | if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) {
|
12827 | prepareFreshStack(root, expirationTime);
|
12828 | startWorkOnPendingInteractions(root, expirationTime);
|
12829 | } else if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
|
12830 |
|
12831 |
|
12832 |
|
12833 |
|
12834 |
|
12835 |
|
12836 |
|
12837 |
|
12838 | if (workInProgressRootHasPendingPing) {
|
12839 |
|
12840 | prepareFreshStack(root, expirationTime);
|
12841 | } else {
|
12842 | var lastPendingTime = root.lastPendingTime;
|
12843 | if (lastPendingTime < expirationTime) {
|
12844 |
|
12845 |
|
12846 | return renderRoot.bind(null, root, lastPendingTime);
|
12847 | }
|
12848 | }
|
12849 | }
|
12850 |
|
12851 |
|
12852 |
|
12853 | if (workInProgress !== null) {
|
12854 | var prevExecutionContext = executionContext;
|
12855 | executionContext |= RenderContext;
|
12856 | var prevDispatcher = ReactCurrentDispatcher.current;
|
12857 | if (prevDispatcher === null) {
|
12858 |
|
12859 |
|
12860 |
|
12861 | prevDispatcher = ContextOnlyDispatcher;
|
12862 | }
|
12863 | ReactCurrentDispatcher.current = ContextOnlyDispatcher;
|
12864 | var prevInteractions = null;
|
12865 | if (enableSchedulerTracing) {
|
12866 | prevInteractions = tracing.__interactionsRef.current;
|
12867 | tracing.__interactionsRef.current = root.memoizedInteractions;
|
12868 | }
|
12869 |
|
12870 | startWorkLoopTimer(workInProgress);
|
12871 |
|
12872 |
|
12873 | if (isSync) {
|
12874 | if (expirationTime !== Sync) {
|
12875 |
|
12876 |
|
12877 |
|
12878 | var currentTime = requestCurrentTime();
|
12879 | if (currentTime < expirationTime) {
|
12880 |
|
12881 | executionContext = prevExecutionContext;
|
12882 | resetContextDependencies();
|
12883 | ReactCurrentDispatcher.current = prevDispatcher;
|
12884 | if (enableSchedulerTracing) {
|
12885 | tracing.__interactionsRef.current = prevInteractions;
|
12886 | }
|
12887 | return renderRoot.bind(null, root, currentTime);
|
12888 | }
|
12889 | }
|
12890 | } else {
|
12891 |
|
12892 |
|
12893 | currentEventTime = NoWork;
|
12894 | }
|
12895 |
|
12896 | do {
|
12897 | try {
|
12898 | if (isSync) {
|
12899 | workLoopSync();
|
12900 | } else {
|
12901 | workLoop();
|
12902 | }
|
12903 | break;
|
12904 | } catch (thrownValue) {
|
12905 |
|
12906 | resetContextDependencies();
|
12907 | resetHooks();
|
12908 |
|
12909 | var sourceFiber = workInProgress;
|
12910 | if (sourceFiber === null || sourceFiber.return === null) {
|
12911 |
|
12912 |
|
12913 |
|
12914 |
|
12915 | prepareFreshStack(root, expirationTime);
|
12916 | executionContext = prevExecutionContext;
|
12917 | throw thrownValue;
|
12918 | }
|
12919 |
|
12920 | if (enableProfilerTimer && sourceFiber.mode & ProfileMode) {
|
12921 |
|
12922 |
|
12923 |
|
12924 | stopProfilerTimerIfRunningAndRecordDelta(sourceFiber, true);
|
12925 | }
|
12926 |
|
12927 | var returnFiber = sourceFiber.return;
|
12928 | throwException(root, returnFiber, sourceFiber, thrownValue, renderExpirationTime);
|
12929 | workInProgress = completeUnitOfWork(sourceFiber);
|
12930 | }
|
12931 | } while (true);
|
12932 |
|
12933 | executionContext = prevExecutionContext;
|
12934 | resetContextDependencies();
|
12935 | ReactCurrentDispatcher.current = prevDispatcher;
|
12936 | if (enableSchedulerTracing) {
|
12937 | tracing.__interactionsRef.current = prevInteractions;
|
12938 | }
|
12939 |
|
12940 | if (workInProgress !== null) {
|
12941 |
|
12942 | stopInterruptedWorkLoopTimer();
|
12943 | if (expirationTime !== Sync) {
|
12944 | startRequestCallbackTimer();
|
12945 | }
|
12946 | return renderRoot.bind(null, root, expirationTime);
|
12947 | }
|
12948 | }
|
12949 |
|
12950 |
|
12951 |
|
12952 | stopFinishedWorkLoopTimer();
|
12953 |
|
12954 | root.finishedWork = root.current.alternate;
|
12955 | root.finishedExpirationTime = expirationTime;
|
12956 |
|
12957 | var isLocked = resolveLocksOnRoot(root, expirationTime);
|
12958 | if (isLocked) {
|
12959 |
|
12960 |
|
12961 |
|
12962 | return null;
|
12963 | }
|
12964 |
|
12965 |
|
12966 | workInProgressRoot = null;
|
12967 |
|
12968 | switch (workInProgressRootExitStatus) {
|
12969 | case RootIncomplete:
|
12970 | {
|
12971 | (function () {
|
12972 | {
|
12973 | {
|
12974 | throw ReactError(Error('Should have a work-in-progress.'));
|
12975 | }
|
12976 | }
|
12977 | })();
|
12978 | }
|
12979 |
|
12980 |
|
12981 |
|
12982 | case RootErrored:
|
12983 | {
|
12984 |
|
12985 |
|
12986 | var _lastPendingTime = root.lastPendingTime;
|
12987 | if (_lastPendingTime < expirationTime) {
|
12988 |
|
12989 |
|
12990 |
|
12991 | return renderRoot.bind(null, root, _lastPendingTime);
|
12992 | }
|
12993 | if (!isSync) {
|
12994 |
|
12995 |
|
12996 |
|
12997 | prepareFreshStack(root, expirationTime);
|
12998 | scheduleSyncCallback(renderRoot.bind(null, root, expirationTime));
|
12999 | return null;
|
13000 | }
|
13001 |
|
13002 |
|
13003 | return commitRoot.bind(null, root);
|
13004 | }
|
13005 | case RootSuspended:
|
13006 | {
|
13007 | flushSuspensePriorityWarningInDEV();
|
13008 |
|
13009 |
|
13010 |
|
13011 |
|
13012 |
|
13013 |
|
13014 |
|
13015 | var hasNotProcessedNewUpdates = workInProgressRootLatestProcessedExpirationTime === Sync;
|
13016 | if (hasNotProcessedNewUpdates && !isSync &&
|
13017 |
|
13018 | !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current)) {
|
13019 |
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 | var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now();
|
13026 |
|
13027 | if (msUntilTimeout > 10) {
|
13028 | if (workInProgressRootHasPendingPing) {
|
13029 |
|
13030 |
|
13031 | prepareFreshStack(root, expirationTime);
|
13032 | return renderRoot.bind(null, root, expirationTime);
|
13033 | }
|
13034 | var _lastPendingTime2 = root.lastPendingTime;
|
13035 | if (_lastPendingTime2 < expirationTime) {
|
13036 |
|
13037 |
|
13038 | return renderRoot.bind(null, root, _lastPendingTime2);
|
13039 | }
|
13040 |
|
13041 |
|
13042 |
|
13043 | root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout);
|
13044 | return null;
|
13045 | }
|
13046 | }
|
13047 |
|
13048 | return commitRoot.bind(null, root);
|
13049 | }
|
13050 | case RootSuspendedWithDelay:
|
13051 | {
|
13052 | flushSuspensePriorityWarningInDEV();
|
13053 |
|
13054 | if (!isSync &&
|
13055 |
|
13056 | !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current)) {
|
13057 |
|
13058 |
|
13059 | if (workInProgressRootHasPendingPing) {
|
13060 |
|
13061 |
|
13062 | prepareFreshStack(root, expirationTime);
|
13063 | return renderRoot.bind(null, root, expirationTime);
|
13064 | }
|
13065 | var _lastPendingTime3 = root.lastPendingTime;
|
13066 | if (_lastPendingTime3 < expirationTime) {
|
13067 |
|
13068 |
|
13069 | return renderRoot.bind(null, root, _lastPendingTime3);
|
13070 | }
|
13071 |
|
13072 | var _msUntilTimeout = void 0;
|
13073 | if (workInProgressRootLatestSuspenseTimeout !== Sync) {
|
13074 |
|
13075 |
|
13076 | _msUntilTimeout = expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now();
|
13077 | } else if (workInProgressRootLatestProcessedExpirationTime === Sync) {
|
13078 |
|
13079 |
|
13080 |
|
13081 | _msUntilTimeout = 0;
|
13082 | } else {
|
13083 |
|
13084 | var eventTimeMs = inferTimeFromExpirationTime(workInProgressRootLatestProcessedExpirationTime);
|
13085 | var currentTimeMs = now();
|
13086 | var timeUntilExpirationMs = expirationTimeToMs(expirationTime) - currentTimeMs;
|
13087 | var timeElapsed = currentTimeMs - eventTimeMs;
|
13088 | if (timeElapsed < 0) {
|
13089 |
|
13090 | timeElapsed = 0;
|
13091 | }
|
13092 |
|
13093 | _msUntilTimeout = jnd(timeElapsed) - timeElapsed;
|
13094 |
|
13095 |
|
13096 |
|
13097 |
|
13098 | if (timeUntilExpirationMs < _msUntilTimeout) {
|
13099 | _msUntilTimeout = timeUntilExpirationMs;
|
13100 | }
|
13101 | }
|
13102 |
|
13103 |
|
13104 | if (_msUntilTimeout > 10) {
|
13105 |
|
13106 |
|
13107 |
|
13108 | root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout);
|
13109 | return null;
|
13110 | }
|
13111 | }
|
13112 |
|
13113 | return commitRoot.bind(null, root);
|
13114 | }
|
13115 | case RootCompleted:
|
13116 | {
|
13117 |
|
13118 | if (!isSync &&
|
13119 |
|
13120 | !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) && workInProgressRootLatestProcessedExpirationTime !== Sync && workInProgressRootCanSuspendUsingConfig !== null) {
|
13121 |
|
13122 |
|
13123 |
|
13124 | var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay(workInProgressRootLatestProcessedExpirationTime, expirationTime, workInProgressRootCanSuspendUsingConfig);
|
13125 | if (_msUntilTimeout2 > 10) {
|
13126 | root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout2);
|
13127 | return null;
|
13128 | }
|
13129 | }
|
13130 | return commitRoot.bind(null, root);
|
13131 | }
|
13132 | default:
|
13133 | {
|
13134 | (function () {
|
13135 | {
|
13136 | {
|
13137 | throw ReactError(Error('Unknown root exit status.'));
|
13138 | }
|
13139 | }
|
13140 | })();
|
13141 | }
|
13142 | }
|
13143 | }
|
13144 |
|
13145 | function markCommitTimeOfFallback() {
|
13146 | globalMostRecentFallbackTime = now();
|
13147 | }
|
13148 |
|
13149 | function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) {
|
13150 | if (expirationTime < workInProgressRootLatestProcessedExpirationTime && expirationTime > Never) {
|
13151 | workInProgressRootLatestProcessedExpirationTime = expirationTime;
|
13152 | }
|
13153 | if (suspenseConfig !== null) {
|
13154 | if (expirationTime < workInProgressRootLatestSuspenseTimeout && expirationTime > Never) {
|
13155 | workInProgressRootLatestSuspenseTimeout = expirationTime;
|
13156 |
|
13157 | workInProgressRootCanSuspendUsingConfig = suspenseConfig;
|
13158 | }
|
13159 | }
|
13160 | }
|
13161 |
|
13162 | function renderDidSuspend() {
|
13163 | if (workInProgressRootExitStatus === RootIncomplete) {
|
13164 | workInProgressRootExitStatus = RootSuspended;
|
13165 | }
|
13166 | }
|
13167 |
|
13168 | function renderDidSuspendDelayIfPossible() {
|
13169 | if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) {
|
13170 | workInProgressRootExitStatus = RootSuspendedWithDelay;
|
13171 | }
|
13172 | }
|
13173 |
|
13174 | function renderDidError() {
|
13175 | if (workInProgressRootExitStatus !== RootCompleted) {
|
13176 | workInProgressRootExitStatus = RootErrored;
|
13177 | }
|
13178 | }
|
13179 |
|
13180 |
|
13181 |
|
13182 | function renderHasNotSuspendedYet() {
|
13183 |
|
13184 |
|
13185 | return workInProgressRootExitStatus === RootIncomplete;
|
13186 | }
|
13187 |
|
13188 | function inferTimeFromExpirationTime(expirationTime) {
|
13189 |
|
13190 |
|
13191 | var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
|
13192 | return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
|
13193 | }
|
13194 |
|
13195 | function inferTimeFromExpirationTimeWithSuspenseConfig(expirationTime, suspenseConfig) {
|
13196 |
|
13197 |
|
13198 |
|
13199 | var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
|
13200 | return earliestExpirationTimeMs - (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
|
13201 | }
|
13202 |
|
13203 | function workLoopSync() {
|
13204 |
|
13205 | while (workInProgress !== null) {
|
13206 | workInProgress = performUnitOfWork(workInProgress);
|
13207 | }
|
13208 | }
|
13209 |
|
13210 | function workLoop() {
|
13211 |
|
13212 | while (workInProgress !== null && !shouldYield()) {
|
13213 | workInProgress = performUnitOfWork(workInProgress);
|
13214 | }
|
13215 | }
|
13216 |
|
13217 | function performUnitOfWork(unitOfWork) {
|
13218 |
|
13219 |
|
13220 |
|
13221 | var current$$1 = unitOfWork.alternate;
|
13222 |
|
13223 | startWorkTimer(unitOfWork);
|
13224 | setCurrentFiber(unitOfWork);
|
13225 |
|
13226 | var next = void 0;
|
13227 | if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoMode) {
|
13228 | startProfilerTimer(unitOfWork);
|
13229 | next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime);
|
13230 | stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
|
13231 | } else {
|
13232 | next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime);
|
13233 | }
|
13234 |
|
13235 | resetCurrentFiber();
|
13236 | unitOfWork.memoizedProps = unitOfWork.pendingProps;
|
13237 | if (next === null) {
|
13238 |
|
13239 | next = completeUnitOfWork(unitOfWork);
|
13240 | }
|
13241 |
|
13242 | ReactCurrentOwner$1.current = null;
|
13243 | return next;
|
13244 | }
|
13245 |
|
13246 | function completeUnitOfWork(unitOfWork) {
|
13247 |
|
13248 |
|
13249 | workInProgress = unitOfWork;
|
13250 | do {
|
13251 |
|
13252 |
|
13253 |
|
13254 | var current$$1 = workInProgress.alternate;
|
13255 | var returnFiber = workInProgress.return;
|
13256 |
|
13257 |
|
13258 | if ((workInProgress.effectTag & Incomplete) === NoEffect) {
|
13259 | setCurrentFiber(workInProgress);
|
13260 | var next = void 0;
|
13261 | if (!enableProfilerTimer || (workInProgress.mode & ProfileMode) === NoMode) {
|
13262 | next = completeWork(current$$1, workInProgress, renderExpirationTime);
|
13263 | } else {
|
13264 | startProfilerTimer(workInProgress);
|
13265 | next = completeWork(current$$1, workInProgress, renderExpirationTime);
|
13266 |
|
13267 | stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
|
13268 | }
|
13269 | stopWorkTimer(workInProgress);
|
13270 | resetCurrentFiber();
|
13271 | resetChildExpirationTime(workInProgress);
|
13272 |
|
13273 | if (next !== null) {
|
13274 |
|
13275 | return next;
|
13276 | }
|
13277 |
|
13278 | if (returnFiber !== null &&
|
13279 |
|
13280 | (returnFiber.effectTag & Incomplete) === NoEffect) {
|
13281 |
|
13282 |
|
13283 |
|
13284 | if (returnFiber.firstEffect === null) {
|
13285 | returnFiber.firstEffect = workInProgress.firstEffect;
|
13286 | }
|
13287 | if (workInProgress.lastEffect !== null) {
|
13288 | if (returnFiber.lastEffect !== null) {
|
13289 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
|
13290 | }
|
13291 | returnFiber.lastEffect = workInProgress.lastEffect;
|
13292 | }
|
13293 |
|
13294 |
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 | var effectTag = workInProgress.effectTag;
|
13301 |
|
13302 |
|
13303 |
|
13304 |
|
13305 | if (effectTag > PerformedWork) {
|
13306 | if (returnFiber.lastEffect !== null) {
|
13307 | returnFiber.lastEffect.nextEffect = workInProgress;
|
13308 | } else {
|
13309 | returnFiber.firstEffect = workInProgress;
|
13310 | }
|
13311 | returnFiber.lastEffect = workInProgress;
|
13312 | }
|
13313 | }
|
13314 | } else {
|
13315 |
|
13316 |
|
13317 |
|
13318 | var _next = unwindWork(workInProgress, renderExpirationTime);
|
13319 |
|
13320 |
|
13321 |
|
13322 | if (enableProfilerTimer && (workInProgress.mode & ProfileMode) !== NoMode) {
|
13323 |
|
13324 | stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
|
13325 |
|
13326 |
|
13327 | var actualDuration = workInProgress.actualDuration;
|
13328 | var child = workInProgress.child;
|
13329 | while (child !== null) {
|
13330 | actualDuration += child.actualDuration;
|
13331 | child = child.sibling;
|
13332 | }
|
13333 | workInProgress.actualDuration = actualDuration;
|
13334 | }
|
13335 |
|
13336 | if (_next !== null) {
|
13337 |
|
13338 |
|
13339 |
|
13340 |
|
13341 |
|
13342 |
|
13343 | stopFailedWorkTimer(workInProgress);
|
13344 | _next.effectTag &= HostEffectMask;
|
13345 | return _next;
|
13346 | }
|
13347 | stopWorkTimer(workInProgress);
|
13348 |
|
13349 | if (returnFiber !== null) {
|
13350 |
|
13351 | returnFiber.firstEffect = returnFiber.lastEffect = null;
|
13352 | returnFiber.effectTag |= Incomplete;
|
13353 | }
|
13354 | }
|
13355 |
|
13356 | var siblingFiber = workInProgress.sibling;
|
13357 | if (siblingFiber !== null) {
|
13358 |
|
13359 | return siblingFiber;
|
13360 | }
|
13361 |
|
13362 | workInProgress = returnFiber;
|
13363 | } while (workInProgress !== null);
|
13364 |
|
13365 |
|
13366 | if (workInProgressRootExitStatus === RootIncomplete) {
|
13367 | workInProgressRootExitStatus = RootCompleted;
|
13368 | }
|
13369 | return null;
|
13370 | }
|
13371 |
|
13372 | function resetChildExpirationTime(completedWork) {
|
13373 | if (renderExpirationTime !== Never && completedWork.childExpirationTime === Never) {
|
13374 |
|
13375 |
|
13376 | return;
|
13377 | }
|
13378 |
|
13379 | var newChildExpirationTime = NoWork;
|
13380 |
|
13381 |
|
13382 | if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) {
|
13383 |
|
13384 |
|
13385 | var actualDuration = completedWork.actualDuration;
|
13386 | var treeBaseDuration = completedWork.selfBaseDuration;
|
13387 |
|
13388 |
|
13389 |
|
13390 |
|
13391 |
|
13392 |
|
13393 |
|
13394 |
|
13395 | var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child;
|
13396 |
|
13397 | var child = completedWork.child;
|
13398 | while (child !== null) {
|
13399 | var childUpdateExpirationTime = child.expirationTime;
|
13400 | var childChildExpirationTime = child.childExpirationTime;
|
13401 | if (childUpdateExpirationTime > newChildExpirationTime) {
|
13402 | newChildExpirationTime = childUpdateExpirationTime;
|
13403 | }
|
13404 | if (childChildExpirationTime > newChildExpirationTime) {
|
13405 | newChildExpirationTime = childChildExpirationTime;
|
13406 | }
|
13407 | if (shouldBubbleActualDurations) {
|
13408 | actualDuration += child.actualDuration;
|
13409 | }
|
13410 | treeBaseDuration += child.treeBaseDuration;
|
13411 | child = child.sibling;
|
13412 | }
|
13413 | completedWork.actualDuration = actualDuration;
|
13414 | completedWork.treeBaseDuration = treeBaseDuration;
|
13415 | } else {
|
13416 | var _child = completedWork.child;
|
13417 | while (_child !== null) {
|
13418 | var _childUpdateExpirationTime = _child.expirationTime;
|
13419 | var _childChildExpirationTime = _child.childExpirationTime;
|
13420 | if (_childUpdateExpirationTime > newChildExpirationTime) {
|
13421 | newChildExpirationTime = _childUpdateExpirationTime;
|
13422 | }
|
13423 | if (_childChildExpirationTime > newChildExpirationTime) {
|
13424 | newChildExpirationTime = _childChildExpirationTime;
|
13425 | }
|
13426 | _child = _child.sibling;
|
13427 | }
|
13428 | }
|
13429 |
|
13430 | completedWork.childExpirationTime = newChildExpirationTime;
|
13431 | }
|
13432 |
|
13433 | function commitRoot(root) {
|
13434 | var renderPriorityLevel = getCurrentPriorityLevel();
|
13435 | runWithPriority(ImmediatePriority, commitRootImpl.bind(null, root, renderPriorityLevel));
|
13436 |
|
13437 |
|
13438 | if (rootWithPendingPassiveEffects !== null) {
|
13439 | scheduleCallback(NormalPriority, function () {
|
13440 | flushPassiveEffects();
|
13441 | return null;
|
13442 | });
|
13443 | }
|
13444 | return null;
|
13445 | }
|
13446 |
|
13447 | function commitRootImpl(root, renderPriorityLevel) {
|
13448 | flushPassiveEffects();
|
13449 | flushRenderPhaseStrictModeWarningsInDEV();
|
13450 |
|
13451 | (function () {
|
13452 | if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
13453 | {
|
13454 | throw ReactError(Error('Should not already be working.'));
|
13455 | }
|
13456 | }
|
13457 | })();
|
13458 |
|
13459 | var finishedWork = root.finishedWork;
|
13460 | var expirationTime = root.finishedExpirationTime;
|
13461 | if (finishedWork === null) {
|
13462 | return null;
|
13463 | }
|
13464 | root.finishedWork = null;
|
13465 | root.finishedExpirationTime = NoWork;
|
13466 |
|
13467 | (function () {
|
13468 | if (!(finishedWork !== root.current)) {
|
13469 | {
|
13470 | throw ReactError(Error('Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.'));
|
13471 | }
|
13472 | }
|
13473 | })();
|
13474 |
|
13475 |
|
13476 |
|
13477 | root.callbackNode = null;
|
13478 | root.callbackExpirationTime = NoWork;
|
13479 |
|
13480 | startCommitTimer();
|
13481 |
|
13482 |
|
13483 |
|
13484 | var updateExpirationTimeBeforeCommit = finishedWork.expirationTime;
|
13485 | var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime;
|
13486 | var firstPendingTimeBeforeCommit = childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit ? childExpirationTimeBeforeCommit : updateExpirationTimeBeforeCommit;
|
13487 | root.firstPendingTime = firstPendingTimeBeforeCommit;
|
13488 | if (firstPendingTimeBeforeCommit < root.lastPendingTime) {
|
13489 |
|
13490 |
|
13491 | root.lastPendingTime = firstPendingTimeBeforeCommit;
|
13492 | }
|
13493 |
|
13494 | if (root === workInProgressRoot) {
|
13495 |
|
13496 | workInProgressRoot = null;
|
13497 | workInProgress = null;
|
13498 | renderExpirationTime = NoWork;
|
13499 | } else {}
|
13500 |
|
13501 |
|
13502 |
|
13503 |
|
13504 |
|
13505 |
|
13506 | var firstEffect = void 0;
|
13507 | if (finishedWork.effectTag > PerformedWork) {
|
13508 |
|
13509 |
|
13510 |
|
13511 |
|
13512 | if (finishedWork.lastEffect !== null) {
|
13513 | finishedWork.lastEffect.nextEffect = finishedWork;
|
13514 | firstEffect = finishedWork.firstEffect;
|
13515 | } else {
|
13516 | firstEffect = finishedWork;
|
13517 | }
|
13518 | } else {
|
13519 |
|
13520 | firstEffect = finishedWork.firstEffect;
|
13521 | }
|
13522 |
|
13523 | if (firstEffect !== null) {
|
13524 | var prevExecutionContext = executionContext;
|
13525 | executionContext |= CommitContext;
|
13526 | var prevInteractions = null;
|
13527 | if (enableSchedulerTracing) {
|
13528 | prevInteractions = tracing.__interactionsRef.current;
|
13529 | tracing.__interactionsRef.current = root.memoizedInteractions;
|
13530 | }
|
13531 |
|
13532 |
|
13533 | ReactCurrentOwner$1.current = null;
|
13534 |
|
13535 |
|
13536 |
|
13537 |
|
13538 |
|
13539 |
|
13540 |
|
13541 |
|
13542 | startCommitSnapshotEffectsTimer();
|
13543 | prepareForCommit(root.containerInfo);
|
13544 | nextEffect = firstEffect;
|
13545 | do {
|
13546 | {
|
13547 | invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
13548 | if (hasCaughtError()) {
|
13549 | (function () {
|
13550 | if (!(nextEffect !== null)) {
|
13551 | {
|
13552 | throw ReactError(Error('Should be working on an effect.'));
|
13553 | }
|
13554 | }
|
13555 | })();
|
13556 | var error = clearCaughtError();
|
13557 | captureCommitPhaseError(nextEffect, error);
|
13558 | nextEffect = nextEffect.nextEffect;
|
13559 | }
|
13560 | }
|
13561 | } while (nextEffect !== null);
|
13562 | stopCommitSnapshotEffectsTimer();
|
13563 |
|
13564 | if (enableProfilerTimer) {
|
13565 |
|
13566 |
|
13567 | recordCommitTime();
|
13568 | }
|
13569 |
|
13570 |
|
13571 | startCommitHostEffectsTimer();
|
13572 | nextEffect = firstEffect;
|
13573 | do {
|
13574 | {
|
13575 | invokeGuardedCallback(null, commitMutationEffects, null, renderPriorityLevel);
|
13576 | if (hasCaughtError()) {
|
13577 | (function () {
|
13578 | if (!(nextEffect !== null)) {
|
13579 | {
|
13580 | throw ReactError(Error('Should be working on an effect.'));
|
13581 | }
|
13582 | }
|
13583 | })();
|
13584 | var _error = clearCaughtError();
|
13585 | captureCommitPhaseError(nextEffect, _error);
|
13586 | nextEffect = nextEffect.nextEffect;
|
13587 | }
|
13588 | }
|
13589 | } while (nextEffect !== null);
|
13590 | stopCommitHostEffectsTimer();
|
13591 | resetAfterCommit(root.containerInfo);
|
13592 |
|
13593 |
|
13594 |
|
13595 |
|
13596 |
|
13597 | root.current = finishedWork;
|
13598 |
|
13599 |
|
13600 |
|
13601 |
|
13602 | startCommitLifeCyclesTimer();
|
13603 | nextEffect = firstEffect;
|
13604 | do {
|
13605 | {
|
13606 | invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
|
13607 | if (hasCaughtError()) {
|
13608 | (function () {
|
13609 | if (!(nextEffect !== null)) {
|
13610 | {
|
13611 | throw ReactError(Error('Should be working on an effect.'));
|
13612 | }
|
13613 | }
|
13614 | })();
|
13615 | var _error2 = clearCaughtError();
|
13616 | captureCommitPhaseError(nextEffect, _error2);
|
13617 | nextEffect = nextEffect.nextEffect;
|
13618 | }
|
13619 | }
|
13620 | } while (nextEffect !== null);
|
13621 | stopCommitLifeCyclesTimer();
|
13622 |
|
13623 | nextEffect = null;
|
13624 |
|
13625 |
|
13626 |
|
13627 | requestPaint();
|
13628 |
|
13629 | if (enableSchedulerTracing) {
|
13630 | tracing.__interactionsRef.current = prevInteractions;
|
13631 | }
|
13632 | executionContext = prevExecutionContext;
|
13633 | } else {
|
13634 |
|
13635 | root.current = finishedWork;
|
13636 |
|
13637 |
|
13638 |
|
13639 | startCommitSnapshotEffectsTimer();
|
13640 | stopCommitSnapshotEffectsTimer();
|
13641 | if (enableProfilerTimer) {
|
13642 | recordCommitTime();
|
13643 | }
|
13644 | startCommitHostEffectsTimer();
|
13645 | stopCommitHostEffectsTimer();
|
13646 | startCommitLifeCyclesTimer();
|
13647 | stopCommitLifeCyclesTimer();
|
13648 | }
|
13649 |
|
13650 | stopCommitTimer();
|
13651 |
|
13652 | var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
|
13653 |
|
13654 | if (rootDoesHavePassiveEffects) {
|
13655 |
|
13656 |
|
13657 | rootDoesHavePassiveEffects = false;
|
13658 | rootWithPendingPassiveEffects = root;
|
13659 | pendingPassiveEffectsExpirationTime = expirationTime;
|
13660 | pendingPassiveEffectsRenderPriority = renderPriorityLevel;
|
13661 | } else {
|
13662 |
|
13663 |
|
13664 |
|
13665 | nextEffect = firstEffect;
|
13666 | while (nextEffect !== null) {
|
13667 | var nextNextEffect = nextEffect.nextEffect;
|
13668 | nextEffect.nextEffect = null;
|
13669 | nextEffect = nextNextEffect;
|
13670 | }
|
13671 | }
|
13672 |
|
13673 |
|
13674 | var remainingExpirationTime = root.firstPendingTime;
|
13675 | if (remainingExpirationTime !== NoWork) {
|
13676 | var currentTime = requestCurrentTime();
|
13677 | var priorityLevel = inferPriorityFromExpirationTime(currentTime, remainingExpirationTime);
|
13678 |
|
13679 | if (enableSchedulerTracing) {
|
13680 | if (spawnedWorkDuringRender !== null) {
|
13681 | var expirationTimes = spawnedWorkDuringRender;
|
13682 | spawnedWorkDuringRender = null;
|
13683 | for (var i = 0; i < expirationTimes.length; i++) {
|
13684 | scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions);
|
13685 | }
|
13686 | }
|
13687 | }
|
13688 |
|
13689 | scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime);
|
13690 | } else {
|
13691 |
|
13692 |
|
13693 | legacyErrorBoundariesThatAlreadyFailed = null;
|
13694 | }
|
13695 |
|
13696 | if (enableSchedulerTracing) {
|
13697 | if (!rootDidHavePassiveEffects) {
|
13698 |
|
13699 |
|
13700 |
|
13701 |
|
13702 | finishPendingInteractions(root, expirationTime);
|
13703 | }
|
13704 | }
|
13705 |
|
13706 | onCommitRoot(finishedWork.stateNode, expirationTime);
|
13707 |
|
13708 | if (remainingExpirationTime === Sync) {
|
13709 |
|
13710 |
|
13711 | if (root === rootWithNestedUpdates) {
|
13712 | nestedUpdateCount++;
|
13713 | } else {
|
13714 | nestedUpdateCount = 0;
|
13715 | rootWithNestedUpdates = root;
|
13716 | }
|
13717 | } else {
|
13718 | nestedUpdateCount = 0;
|
13719 | }
|
13720 |
|
13721 | if (hasUncaughtError) {
|
13722 | hasUncaughtError = false;
|
13723 | var _error3 = firstUncaughtError;
|
13724 | firstUncaughtError = null;
|
13725 | throw _error3;
|
13726 | }
|
13727 |
|
13728 | if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
|
13729 |
|
13730 |
|
13731 |
|
13732 |
|
13733 | return null;
|
13734 | }
|
13735 |
|
13736 |
|
13737 | flushSyncCallbackQueue();
|
13738 | return null;
|
13739 | }
|
13740 |
|
13741 | function commitBeforeMutationEffects() {
|
13742 | while (nextEffect !== null) {
|
13743 | if ((nextEffect.effectTag & Snapshot) !== NoEffect) {
|
13744 | setCurrentFiber(nextEffect);
|
13745 | recordEffect();
|
13746 |
|
13747 | var current$$1 = nextEffect.alternate;
|
13748 | commitBeforeMutationLifeCycles(current$$1, nextEffect);
|
13749 |
|
13750 | resetCurrentFiber();
|
13751 | }
|
13752 | nextEffect = nextEffect.nextEffect;
|
13753 | }
|
13754 | }
|
13755 |
|
13756 | function commitMutationEffects(renderPriorityLevel) {
|
13757 |
|
13758 | while (nextEffect !== null) {
|
13759 | setCurrentFiber(nextEffect);
|
13760 |
|
13761 | var effectTag = nextEffect.effectTag;
|
13762 |
|
13763 | if (effectTag & ContentReset) {
|
13764 | commitResetTextContent(nextEffect);
|
13765 | }
|
13766 |
|
13767 | if (effectTag & Ref) {
|
13768 | var current$$1 = nextEffect.alternate;
|
13769 | if (current$$1 !== null) {
|
13770 | commitDetachRef(current$$1);
|
13771 | }
|
13772 | }
|
13773 |
|
13774 |
|
13775 |
|
13776 |
|
13777 |
|
13778 | var primaryEffectTag = effectTag & (Placement | Update | Deletion);
|
13779 | switch (primaryEffectTag) {
|
13780 | case Placement:
|
13781 | {
|
13782 | commitPlacement(nextEffect);
|
13783 |
|
13784 |
|
13785 |
|
13786 |
|
13787 | nextEffect.effectTag &= ~Placement;
|
13788 | break;
|
13789 | }
|
13790 | case PlacementAndUpdate:
|
13791 | {
|
13792 |
|
13793 | commitPlacement(nextEffect);
|
13794 |
|
13795 |
|
13796 | nextEffect.effectTag &= ~Placement;
|
13797 |
|
13798 |
|
13799 | var _current = nextEffect.alternate;
|
13800 | commitWork(_current, nextEffect);
|
13801 | break;
|
13802 | }
|
13803 | case Update:
|
13804 | {
|
13805 | var _current2 = nextEffect.alternate;
|
13806 | commitWork(_current2, nextEffect);
|
13807 | break;
|
13808 | }
|
13809 | case Deletion:
|
13810 | {
|
13811 | commitDeletion(nextEffect, renderPriorityLevel);
|
13812 | break;
|
13813 | }
|
13814 | }
|
13815 |
|
13816 |
|
13817 | recordEffect();
|
13818 |
|
13819 | resetCurrentFiber();
|
13820 | nextEffect = nextEffect.nextEffect;
|
13821 | }
|
13822 | }
|
13823 |
|
13824 | function commitLayoutEffects(root, committedExpirationTime) {
|
13825 |
|
13826 | while (nextEffect !== null) {
|
13827 | setCurrentFiber(nextEffect);
|
13828 |
|
13829 | var effectTag = nextEffect.effectTag;
|
13830 |
|
13831 | if (effectTag & (Update | Callback)) {
|
13832 | recordEffect();
|
13833 | var current$$1 = nextEffect.alternate;
|
13834 | commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime);
|
13835 | }
|
13836 |
|
13837 | if (effectTag & Ref) {
|
13838 | recordEffect();
|
13839 | commitAttachRef(nextEffect);
|
13840 | }
|
13841 |
|
13842 | if (effectTag & Passive) {
|
13843 | rootDoesHavePassiveEffects = true;
|
13844 | }
|
13845 |
|
13846 | resetCurrentFiber();
|
13847 | nextEffect = nextEffect.nextEffect;
|
13848 | }
|
13849 | }
|
13850 |
|
13851 | function flushPassiveEffects() {
|
13852 | if (rootWithPendingPassiveEffects === null) {
|
13853 | return false;
|
13854 | }
|
13855 | var root = rootWithPendingPassiveEffects;
|
13856 | var expirationTime = pendingPassiveEffectsExpirationTime;
|
13857 | var renderPriorityLevel = pendingPassiveEffectsRenderPriority;
|
13858 | rootWithPendingPassiveEffects = null;
|
13859 | pendingPassiveEffectsExpirationTime = NoWork;
|
13860 | pendingPassiveEffectsRenderPriority = NoPriority;
|
13861 | var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
|
13862 | return runWithPriority(priorityLevel, flushPassiveEffectsImpl.bind(null, root, expirationTime));
|
13863 | }
|
13864 |
|
13865 | function flushPassiveEffectsImpl(root, expirationTime) {
|
13866 | var prevInteractions = null;
|
13867 | if (enableSchedulerTracing) {
|
13868 | prevInteractions = tracing.__interactionsRef.current;
|
13869 | tracing.__interactionsRef.current = root.memoizedInteractions;
|
13870 | }
|
13871 |
|
13872 | (function () {
|
13873 | if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
13874 | {
|
13875 | throw ReactError(Error('Cannot flush passive effects while already rendering.'));
|
13876 | }
|
13877 | }
|
13878 | })();
|
13879 | var prevExecutionContext = executionContext;
|
13880 | executionContext |= CommitContext;
|
13881 |
|
13882 |
|
13883 |
|
13884 |
|
13885 | var effect = root.current.firstEffect;
|
13886 | while (effect !== null) {
|
13887 | {
|
13888 | setCurrentFiber(effect);
|
13889 | invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
|
13890 | if (hasCaughtError()) {
|
13891 | (function () {
|
13892 | if (!(effect !== null)) {
|
13893 | {
|
13894 | throw ReactError(Error('Should be working on an effect.'));
|
13895 | }
|
13896 | }
|
13897 | })();
|
13898 | var error = clearCaughtError();
|
13899 | captureCommitPhaseError(effect, error);
|
13900 | }
|
13901 | resetCurrentFiber();
|
13902 | }
|
13903 | var nextNextEffect = effect.nextEffect;
|
13904 |
|
13905 | effect.nextEffect = null;
|
13906 | effect = nextNextEffect;
|
13907 | }
|
13908 |
|
13909 | if (enableSchedulerTracing) {
|
13910 | tracing.__interactionsRef.current = prevInteractions;
|
13911 | finishPendingInteractions(root, expirationTime);
|
13912 | }
|
13913 |
|
13914 | executionContext = prevExecutionContext;
|
13915 | flushSyncCallbackQueue();
|
13916 |
|
13917 |
|
13918 |
|
13919 | nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1;
|
13920 |
|
13921 | return true;
|
13922 | }
|
13923 |
|
13924 | function isAlreadyFailedLegacyErrorBoundary(instance) {
|
13925 | return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
|
13926 | }
|
13927 |
|
13928 | function markLegacyErrorBoundaryAsFailed(instance) {
|
13929 | if (legacyErrorBoundariesThatAlreadyFailed === null) {
|
13930 | legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
|
13931 | } else {
|
13932 | legacyErrorBoundariesThatAlreadyFailed.add(instance);
|
13933 | }
|
13934 | }
|
13935 |
|
13936 | function prepareToThrowUncaughtError(error) {
|
13937 | if (!hasUncaughtError) {
|
13938 | hasUncaughtError = true;
|
13939 | firstUncaughtError = error;
|
13940 | }
|
13941 | }
|
13942 | var onUncaughtError = prepareToThrowUncaughtError;
|
13943 |
|
13944 | function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
|
13945 | var errorInfo = createCapturedValue(error, sourceFiber);
|
13946 | var update = createRootErrorUpdate(rootFiber, errorInfo, Sync);
|
13947 | enqueueUpdate(rootFiber, update);
|
13948 | var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync);
|
13949 | if (root !== null) {
|
13950 | scheduleCallbackForRoot(root, ImmediatePriority, Sync);
|
13951 | }
|
13952 | }
|
13953 |
|
13954 | function captureCommitPhaseError(sourceFiber, error) {
|
13955 | if (sourceFiber.tag === HostRoot) {
|
13956 |
|
13957 |
|
13958 | captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
|
13959 | return;
|
13960 | }
|
13961 |
|
13962 | var fiber = sourceFiber.return;
|
13963 | while (fiber !== null) {
|
13964 | if (fiber.tag === HostRoot) {
|
13965 | captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
|
13966 | return;
|
13967 | } else if (fiber.tag === ClassComponent) {
|
13968 | var ctor = fiber.type;
|
13969 | var instance = fiber.stateNode;
|
13970 | if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
|
13971 | var errorInfo = createCapturedValue(error, sourceFiber);
|
13972 | var update = createClassErrorUpdate(fiber, errorInfo,
|
13973 |
|
13974 | Sync);
|
13975 | enqueueUpdate(fiber, update);
|
13976 | var root = markUpdateTimeFromFiberToRoot(fiber, Sync);
|
13977 | if (root !== null) {
|
13978 | scheduleCallbackForRoot(root, ImmediatePriority, Sync);
|
13979 | }
|
13980 | return;
|
13981 | }
|
13982 | }
|
13983 | fiber = fiber.return;
|
13984 | }
|
13985 | }
|
13986 |
|
13987 | function pingSuspendedRoot(root, thenable, suspendedTime) {
|
13988 | var pingCache = root.pingCache;
|
13989 | if (pingCache !== null) {
|
13990 |
|
13991 |
|
13992 | pingCache.delete(thenable);
|
13993 | }
|
13994 |
|
13995 | if (workInProgressRoot === root && renderExpirationTime === suspendedTime) {
|
13996 |
|
13997 |
|
13998 |
|
13999 |
|
14000 |
|
14001 |
|
14002 |
|
14003 |
|
14004 |
|
14005 |
|
14006 |
|
14007 |
|
14008 |
|
14009 | if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && workInProgressRootLatestProcessedExpirationTime === Sync && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
|
14010 |
|
14011 |
|
14012 | prepareFreshStack(root, renderExpirationTime);
|
14013 | } else {
|
14014 |
|
14015 |
|
14016 | workInProgressRootHasPendingPing = true;
|
14017 | }
|
14018 | return;
|
14019 | }
|
14020 |
|
14021 | var lastPendingTime = root.lastPendingTime;
|
14022 | if (lastPendingTime < suspendedTime) {
|
14023 |
|
14024 | return;
|
14025 | }
|
14026 |
|
14027 | var pingTime = root.pingTime;
|
14028 | if (pingTime !== NoWork && pingTime < suspendedTime) {
|
14029 |
|
14030 | return;
|
14031 | }
|
14032 |
|
14033 |
|
14034 | root.pingTime = suspendedTime;
|
14035 |
|
14036 | if (root.finishedExpirationTime === suspendedTime) {
|
14037 |
|
14038 | root.finishedExpirationTime = NoWork;
|
14039 | root.finishedWork = null;
|
14040 | }
|
14041 |
|
14042 | var currentTime = requestCurrentTime();
|
14043 | var priorityLevel = inferPriorityFromExpirationTime(currentTime, suspendedTime);
|
14044 | scheduleCallbackForRoot(root, priorityLevel, suspendedTime);
|
14045 | }
|
14046 |
|
14047 | function retryTimedOutBoundary(boundaryFiber) {
|
14048 |
|
14049 |
|
14050 |
|
14051 |
|
14052 | var currentTime = requestCurrentTime();
|
14053 | var suspenseConfig = null;
|
14054 | var retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
|
14055 |
|
14056 | var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime);
|
14057 | var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime);
|
14058 | if (root !== null) {
|
14059 | scheduleCallbackForRoot(root, priorityLevel, retryTime);
|
14060 | }
|
14061 | }
|
14062 |
|
14063 | function resolveRetryThenable(boundaryFiber, thenable) {
|
14064 | var retryCache = void 0;
|
14065 | if (enableSuspenseServerRenderer) {
|
14066 | switch (boundaryFiber.tag) {
|
14067 | case SuspenseComponent:
|
14068 | retryCache = boundaryFiber.stateNode;
|
14069 | break;
|
14070 | case DehydratedSuspenseComponent:
|
14071 | retryCache = boundaryFiber.memoizedState;
|
14072 | break;
|
14073 | default:
|
14074 | (function () {
|
14075 | {
|
14076 | {
|
14077 | throw ReactError(Error('Pinged unknown suspense boundary type. This is probably a bug in React.'));
|
14078 | }
|
14079 | }
|
14080 | })();
|
14081 | }
|
14082 | } else {
|
14083 | retryCache = boundaryFiber.stateNode;
|
14084 | }
|
14085 |
|
14086 | if (retryCache !== null) {
|
14087 |
|
14088 |
|
14089 | retryCache.delete(thenable);
|
14090 | }
|
14091 |
|
14092 | retryTimedOutBoundary(boundaryFiber);
|
14093 | }
|
14094 |
|
14095 |
|
14096 |
|
14097 |
|
14098 |
|
14099 |
|
14100 |
|
14101 |
|
14102 |
|
14103 |
|
14104 | function jnd(timeElapsed) {
|
14105 | return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960;
|
14106 | }
|
14107 |
|
14108 | function computeMsUntilSuspenseLoadingDelay(mostRecentEventTime, committedExpirationTime, suspenseConfig) {
|
14109 | var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0;
|
14110 | if (busyMinDurationMs <= 0) {
|
14111 | return 0;
|
14112 | }
|
14113 | var busyDelayMs = suspenseConfig.busyDelayMs | 0;
|
14114 |
|
14115 |
|
14116 | var currentTimeMs = now();
|
14117 | var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig(mostRecentEventTime, suspenseConfig);
|
14118 | var timeElapsed = currentTimeMs - eventTimeMs;
|
14119 | if (timeElapsed <= busyDelayMs) {
|
14120 |
|
14121 |
|
14122 | return 0;
|
14123 | }
|
14124 | var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed;
|
14125 |
|
14126 | return msUntilTimeout;
|
14127 | }
|
14128 |
|
14129 | function checkForNestedUpdates() {
|
14130 | if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
|
14131 | nestedUpdateCount = 0;
|
14132 | rootWithNestedUpdates = null;
|
14133 | (function () {
|
14134 | {
|
14135 | {
|
14136 | throw ReactError(Error('Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.'));
|
14137 | }
|
14138 | }
|
14139 | })();
|
14140 | }
|
14141 |
|
14142 | {
|
14143 | if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
|
14144 | nestedPassiveUpdateCount = 0;
|
14145 | warning$1(false, 'Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.');
|
14146 | }
|
14147 | }
|
14148 | }
|
14149 |
|
14150 | function flushRenderPhaseStrictModeWarningsInDEV() {
|
14151 | {
|
14152 | ReactStrictModeWarnings.flushLegacyContextWarning();
|
14153 |
|
14154 | if (warnAboutDeprecatedLifecycles) {
|
14155 | ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
|
14156 | }
|
14157 | }
|
14158 | }
|
14159 |
|
14160 | function stopFinishedWorkLoopTimer() {
|
14161 | var didCompleteRoot = true;
|
14162 | stopWorkLoopTimer(interruptedBy, didCompleteRoot);
|
14163 | interruptedBy = null;
|
14164 | }
|
14165 |
|
14166 | function stopInterruptedWorkLoopTimer() {
|
14167 |
|
14168 | var didCompleteRoot = false;
|
14169 | stopWorkLoopTimer(interruptedBy, didCompleteRoot);
|
14170 | interruptedBy = null;
|
14171 | }
|
14172 |
|
14173 | function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) {
|
14174 | if (enableUserTimingAPI && workInProgressRoot !== null && updateExpirationTime > renderExpirationTime) {
|
14175 | interruptedBy = fiberThatReceivedUpdate;
|
14176 | }
|
14177 | }
|
14178 |
|
14179 | var didWarnStateUpdateForUnmountedComponent = null;
|
14180 | function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
|
14181 | {
|
14182 | var tag = fiber.tag;
|
14183 | if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) {
|
14184 |
|
14185 | return;
|
14186 | }
|
14187 |
|
14188 |
|
14189 | var componentName = getComponentName(fiber.type) || 'ReactComponent';
|
14190 | if (didWarnStateUpdateForUnmountedComponent !== null) {
|
14191 | if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
|
14192 | return;
|
14193 | }
|
14194 | didWarnStateUpdateForUnmountedComponent.add(componentName);
|
14195 | } else {
|
14196 | didWarnStateUpdateForUnmountedComponent = new Set([componentName]);
|
14197 | }
|
14198 | warningWithoutStack$1(false, "Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.%s', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
|
14199 | }
|
14200 | }
|
14201 |
|
14202 | var beginWork$$1 = void 0;
|
14203 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
|
14204 | var dummyFiber = null;
|
14205 | beginWork$$1 = function (current$$1, unitOfWork, expirationTime) {
|
14206 |
|
14207 |
|
14208 |
|
14209 |
|
14210 |
|
14211 |
|
14212 | var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork);
|
14213 | try {
|
14214 | return beginWork$1(current$$1, unitOfWork, expirationTime);
|
14215 | } catch (originalError) {
|
14216 | if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
|
14217 |
|
14218 | throw originalError;
|
14219 | }
|
14220 |
|
14221 |
|
14222 |
|
14223 | resetContextDependencies();
|
14224 | resetHooks();
|
14225 |
|
14226 |
|
14227 | unwindInterruptedWork(unitOfWork);
|
14228 |
|
14229 |
|
14230 | assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
|
14231 |
|
14232 | if (enableProfilerTimer && unitOfWork.mode & ProfileMode) {
|
14233 |
|
14234 | startProfilerTimer(unitOfWork);
|
14235 | }
|
14236 |
|
14237 |
|
14238 | invokeGuardedCallback(null, beginWork$1, null, current$$1, unitOfWork, expirationTime);
|
14239 |
|
14240 | if (hasCaughtError()) {
|
14241 | var replayError = clearCaughtError();
|
14242 |
|
14243 |
|
14244 | throw replayError;
|
14245 | } else {
|
14246 |
|
14247 | throw originalError;
|
14248 | }
|
14249 | }
|
14250 | };
|
14251 | } else {
|
14252 | beginWork$$1 = beginWork$1;
|
14253 | }
|
14254 |
|
14255 | var didWarnAboutUpdateInRender = false;
|
14256 | var didWarnAboutUpdateInGetChildContext = false;
|
14257 | function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) {
|
14258 | {
|
14259 | if (fiber.tag === ClassComponent) {
|
14260 | switch (phase) {
|
14261 | case 'getChildContext':
|
14262 | if (didWarnAboutUpdateInGetChildContext) {
|
14263 | return;
|
14264 | }
|
14265 | warningWithoutStack$1(false, 'setState(...): Cannot call setState() inside getChildContext()');
|
14266 | didWarnAboutUpdateInGetChildContext = true;
|
14267 | break;
|
14268 | case 'render':
|
14269 | if (didWarnAboutUpdateInRender) {
|
14270 | return;
|
14271 | }
|
14272 | warningWithoutStack$1(false, 'Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure function of ' + 'props and state.');
|
14273 | didWarnAboutUpdateInRender = true;
|
14274 | break;
|
14275 | }
|
14276 | }
|
14277 | }
|
14278 | }
|
14279 |
|
14280 |
|
14281 | var IsThisRendererActing = { current: false };
|
14282 |
|
14283 | function warnIfNotScopedWithMatchingAct(fiber) {
|
14284 | {
|
14285 | if (warnsIfNotActing === true && IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) {
|
14286 | warningWithoutStack$1(false, "It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + "import {act} from 'react-dom/test-utils';\n" + '//...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + "import TestRenderer from 'react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '//...\n' + 'act(() => ...);' + '%s', getStackByFiberInDevAndProd(fiber));
|
14287 | }
|
14288 | }
|
14289 | }
|
14290 |
|
14291 | function warnIfNotCurrentlyActingEffectsInDEV(fiber) {
|
14292 | {
|
14293 | if (warnsIfNotActing === true && (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
|
14294 | warningWithoutStack$1(false, 'An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
|
14295 | }
|
14296 | }
|
14297 | }
|
14298 |
|
14299 | function warnIfNotCurrentlyActingUpdatesInDEV(fiber) {
|
14300 | {
|
14301 | if (warnsIfNotActing === true && executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
|
14302 | warningWithoutStack$1(false, 'An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
|
14303 | }
|
14304 | }
|
14305 | }
|
14306 |
|
14307 | var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV;
|
14308 |
|
14309 |
|
14310 | var didWarnAboutUnmockedScheduler = false;
|
14311 |
|
14312 |
|
14313 |
|
14314 |
|
14315 |
|
14316 | function warnIfUnmockedScheduler(fiber) {
|
14317 | {
|
14318 | if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) {
|
14319 | if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {
|
14320 | didWarnAboutUnmockedScheduler = true;
|
14321 | warningWithoutStack$1(false, 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
|
14322 | } else if (warnAboutUnmockedScheduler === true) {
|
14323 | didWarnAboutUnmockedScheduler = true;
|
14324 | warningWithoutStack$1(false, 'Starting from React v17, the "scheduler" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
|
14325 | }
|
14326 | }
|
14327 | }
|
14328 | }
|
14329 |
|
14330 | var componentsThatTriggeredHighPriSuspend = null;
|
14331 | function checkForWrongSuspensePriorityInDEV(sourceFiber) {
|
14332 | {
|
14333 | var currentPriorityLevel = getCurrentPriorityLevel();
|
14334 | if ((sourceFiber.mode & ConcurrentMode) !== NoEffect && (currentPriorityLevel === UserBlockingPriority || currentPriorityLevel === ImmediatePriority)) {
|
14335 | var workInProgressNode = sourceFiber;
|
14336 | while (workInProgressNode !== null) {
|
14337 |
|
14338 | var current$$1 = workInProgressNode.alternate;
|
14339 | if (current$$1 !== null) {
|
14340 |
|
14341 |
|
14342 | switch (workInProgressNode.tag) {
|
14343 | case ClassComponent:
|
14344 |
|
14345 |
|
14346 | var updateQueue = current$$1.updateQueue;
|
14347 | if (updateQueue !== null) {
|
14348 | var update = updateQueue.firstUpdate;
|
14349 | while (update !== null) {
|
14350 | var priorityLevel = update.priority;
|
14351 | if (priorityLevel === UserBlockingPriority || priorityLevel === ImmediatePriority) {
|
14352 | if (componentsThatTriggeredHighPriSuspend === null) {
|
14353 | componentsThatTriggeredHighPriSuspend = new Set([getComponentName(workInProgressNode.type)]);
|
14354 | } else {
|
14355 | componentsThatTriggeredHighPriSuspend.add(getComponentName(workInProgressNode.type));
|
14356 | }
|
14357 | break;
|
14358 | }
|
14359 | update = update.next;
|
14360 | }
|
14361 | }
|
14362 | break;
|
14363 | case FunctionComponent:
|
14364 | case ForwardRef:
|
14365 | case SimpleMemoComponent:
|
14366 | if (workInProgressNode.memoizedState !== null && workInProgressNode.memoizedState.baseUpdate !== null) {
|
14367 | var _update = workInProgressNode.memoizedState.baseUpdate;
|
14368 |
|
14369 |
|
14370 | while (_update !== null) {
|
14371 | var priority = _update.priority;
|
14372 | if (priority === UserBlockingPriority || priority === ImmediatePriority) {
|
14373 | if (componentsThatTriggeredHighPriSuspend === null) {
|
14374 | componentsThatTriggeredHighPriSuspend = new Set([getComponentName(workInProgressNode.type)]);
|
14375 | } else {
|
14376 | componentsThatTriggeredHighPriSuspend.add(getComponentName(workInProgressNode.type));
|
14377 | }
|
14378 | break;
|
14379 | }
|
14380 | if (_update.next === workInProgressNode.memoizedState.baseUpdate) {
|
14381 | break;
|
14382 | }
|
14383 | _update = _update.next;
|
14384 | }
|
14385 | }
|
14386 | break;
|
14387 | default:
|
14388 | break;
|
14389 | }
|
14390 | }
|
14391 | workInProgressNode = workInProgressNode.return;
|
14392 | }
|
14393 | }
|
14394 | }
|
14395 | }
|
14396 |
|
14397 | function flushSuspensePriorityWarningInDEV() {
|
14398 | {
|
14399 | if (componentsThatTriggeredHighPriSuspend !== null) {
|
14400 | var componentNames = [];
|
14401 | componentsThatTriggeredHighPriSuspend.forEach(function (name) {
|
14402 | return componentNames.push(name);
|
14403 | });
|
14404 | componentsThatTriggeredHighPriSuspend = null;
|
14405 |
|
14406 | if (componentNames.length > 0) {
|
14407 | warningWithoutStack$1(false, '%s triggered a user-blocking update that suspended.' + '\n\n' + 'The fix is to split the update into multiple parts: a user-blocking ' + 'update to provide immediate feedback, and another update that ' + 'triggers the bulk of the changes.' + '\n\n' + 'Refer to the documentation for useSuspenseTransition to learn how ' + 'to implement this pattern.',
|
14408 |
|
14409 | componentNames.sort().join(', '));
|
14410 | }
|
14411 | }
|
14412 | }
|
14413 | }
|
14414 |
|
14415 | function computeThreadID(root, expirationTime) {
|
14416 |
|
14417 | return expirationTime * 1000 + root.interactionThreadID;
|
14418 | }
|
14419 |
|
14420 | function markSpawnedWork(expirationTime) {
|
14421 | if (!enableSchedulerTracing) {
|
14422 | return;
|
14423 | }
|
14424 | if (spawnedWorkDuringRender === null) {
|
14425 | spawnedWorkDuringRender = [expirationTime];
|
14426 | } else {
|
14427 | spawnedWorkDuringRender.push(expirationTime);
|
14428 | }
|
14429 | }
|
14430 |
|
14431 | function scheduleInteractions(root, expirationTime, interactions) {
|
14432 | if (!enableSchedulerTracing) {
|
14433 | return;
|
14434 | }
|
14435 |
|
14436 | if (interactions.size > 0) {
|
14437 | var pendingInteractionMap = root.pendingInteractionMap;
|
14438 | var pendingInteractions = pendingInteractionMap.get(expirationTime);
|
14439 | if (pendingInteractions != null) {
|
14440 | interactions.forEach(function (interaction) {
|
14441 | if (!pendingInteractions.has(interaction)) {
|
14442 |
|
14443 | interaction.__count++;
|
14444 | }
|
14445 |
|
14446 | pendingInteractions.add(interaction);
|
14447 | });
|
14448 | } else {
|
14449 | pendingInteractionMap.set(expirationTime, new Set(interactions));
|
14450 |
|
14451 |
|
14452 | interactions.forEach(function (interaction) {
|
14453 | interaction.__count++;
|
14454 | });
|
14455 | }
|
14456 |
|
14457 | var subscriber = tracing.__subscriberRef.current;
|
14458 | if (subscriber !== null) {
|
14459 | var threadID = computeThreadID(root, expirationTime);
|
14460 | subscriber.onWorkScheduled(interactions, threadID);
|
14461 | }
|
14462 | }
|
14463 | }
|
14464 |
|
14465 | function schedulePendingInteractions(root, expirationTime) {
|
14466 |
|
14467 |
|
14468 |
|
14469 | if (!enableSchedulerTracing) {
|
14470 | return;
|
14471 | }
|
14472 |
|
14473 | scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current);
|
14474 | }
|
14475 |
|
14476 | function startWorkOnPendingInteractions(root, expirationTime) {
|
14477 |
|
14478 | if (!enableSchedulerTracing) {
|
14479 | return;
|
14480 | }
|
14481 |
|
14482 |
|
14483 |
|
14484 |
|
14485 | var interactions = new Set();
|
14486 | root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
|
14487 | if (scheduledExpirationTime >= expirationTime) {
|
14488 | scheduledInteractions.forEach(function (interaction) {
|
14489 | return interactions.add(interaction);
|
14490 | });
|
14491 | }
|
14492 | });
|
14493 |
|
14494 |
|
14495 |
|
14496 |
|
14497 |
|
14498 |
|
14499 | root.memoizedInteractions = interactions;
|
14500 |
|
14501 | if (interactions.size > 0) {
|
14502 | var subscriber = tracing.__subscriberRef.current;
|
14503 | if (subscriber !== null) {
|
14504 | var threadID = computeThreadID(root, expirationTime);
|
14505 | try {
|
14506 | subscriber.onWorkStarted(interactions, threadID);
|
14507 | } catch (error) {
|
14508 |
|
14509 | scheduleCallback(ImmediatePriority, function () {
|
14510 | throw error;
|
14511 | });
|
14512 | }
|
14513 | }
|
14514 | }
|
14515 | }
|
14516 |
|
14517 | function finishPendingInteractions(root, committedExpirationTime) {
|
14518 | if (!enableSchedulerTracing) {
|
14519 | return;
|
14520 | }
|
14521 |
|
14522 | var earliestRemainingTimeAfterCommit = root.firstPendingTime;
|
14523 |
|
14524 | var subscriber = void 0;
|
14525 |
|
14526 | try {
|
14527 | subscriber = tracing.__subscriberRef.current;
|
14528 | if (subscriber !== null && root.memoizedInteractions.size > 0) {
|
14529 | var threadID = computeThreadID(root, committedExpirationTime);
|
14530 | subscriber.onWorkStopped(root.memoizedInteractions, threadID);
|
14531 | }
|
14532 | } catch (error) {
|
14533 |
|
14534 | scheduleCallback(ImmediatePriority, function () {
|
14535 | throw error;
|
14536 | });
|
14537 | } finally {
|
14538 |
|
14539 |
|
14540 |
|
14541 | var pendingInteractionMap = root.pendingInteractionMap;
|
14542 | pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
|
14543 |
|
14544 |
|
14545 |
|
14546 | if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
|
14547 | pendingInteractionMap.delete(scheduledExpirationTime);
|
14548 |
|
14549 | scheduledInteractions.forEach(function (interaction) {
|
14550 | interaction.__count--;
|
14551 |
|
14552 | if (subscriber !== null && interaction.__count === 0) {
|
14553 | try {
|
14554 | subscriber.onInteractionScheduledWorkCompleted(interaction);
|
14555 | } catch (error) {
|
14556 |
|
14557 | scheduleCallback(ImmediatePriority, function () {
|
14558 | throw error;
|
14559 | });
|
14560 | }
|
14561 | }
|
14562 | });
|
14563 | }
|
14564 | });
|
14565 | }
|
14566 | }
|
14567 |
|
14568 | var onCommitFiberRoot = null;
|
14569 | var onCommitFiberUnmount = null;
|
14570 | var hasLoggedError = false;
|
14571 |
|
14572 | var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
|
14573 |
|
14574 | function injectInternals(internals) {
|
14575 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
|
14576 |
|
14577 | return false;
|
14578 | }
|
14579 | var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
14580 | if (hook.isDisabled) {
|
14581 |
|
14582 |
|
14583 |
|
14584 | return true;
|
14585 | }
|
14586 | if (!hook.supportsFiber) {
|
14587 | {
|
14588 | warningWithoutStack$1(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
|
14589 | }
|
14590 |
|
14591 | return true;
|
14592 | }
|
14593 | try {
|
14594 | var rendererID = hook.inject(internals);
|
14595 |
|
14596 | onCommitFiberRoot = function (root, expirationTime) {
|
14597 | try {
|
14598 | var didError = (root.current.effectTag & DidCapture) === DidCapture;
|
14599 | if (enableProfilerTimer) {
|
14600 | var currentTime = requestCurrentTime();
|
14601 | var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
|
14602 | hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
|
14603 | } else {
|
14604 | hook.onCommitFiberRoot(rendererID, root, undefined, didError);
|
14605 | }
|
14606 | } catch (err) {
|
14607 | if (true && !hasLoggedError) {
|
14608 | hasLoggedError = true;
|
14609 | warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
|
14610 | }
|
14611 | }
|
14612 | };
|
14613 | onCommitFiberUnmount = function (fiber) {
|
14614 | try {
|
14615 | hook.onCommitFiberUnmount(rendererID, fiber);
|
14616 | } catch (err) {
|
14617 | if (true && !hasLoggedError) {
|
14618 | hasLoggedError = true;
|
14619 | warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
|
14620 | }
|
14621 | }
|
14622 | };
|
14623 | } catch (err) {
|
14624 |
|
14625 | {
|
14626 | warningWithoutStack$1(false, 'React DevTools encountered an error: %s.', err);
|
14627 | }
|
14628 | }
|
14629 |
|
14630 | return true;
|
14631 | }
|
14632 |
|
14633 | function onCommitRoot(root, expirationTime) {
|
14634 | if (typeof onCommitFiberRoot === 'function') {
|
14635 | onCommitFiberRoot(root, expirationTime);
|
14636 | }
|
14637 | }
|
14638 |
|
14639 | function onCommitUnmount(fiber) {
|
14640 | if (typeof onCommitFiberUnmount === 'function') {
|
14641 | onCommitFiberUnmount(fiber);
|
14642 | }
|
14643 | }
|
14644 |
|
14645 | var hasBadMapPolyfill = void 0;
|
14646 |
|
14647 | {
|
14648 | hasBadMapPolyfill = false;
|
14649 | try {
|
14650 | var nonExtensibleObject = Object.preventExtensions({});
|
14651 | var testMap = new Map([[nonExtensibleObject, null]]);
|
14652 | var testSet = new Set([nonExtensibleObject]);
|
14653 |
|
14654 |
|
14655 |
|
14656 | testMap.set(0, 0);
|
14657 | testSet.add(0);
|
14658 | } catch (e) {
|
14659 |
|
14660 | hasBadMapPolyfill = true;
|
14661 | }
|
14662 | }
|
14663 |
|
14664 |
|
14665 |
|
14666 |
|
14667 |
|
14668 | var debugCounter = void 0;
|
14669 |
|
14670 | {
|
14671 | debugCounter = 1;
|
14672 | }
|
14673 |
|
14674 | function FiberNode(tag, pendingProps, key, mode) {
|
14675 |
|
14676 | this.tag = tag;
|
14677 | this.key = key;
|
14678 | this.elementType = null;
|
14679 | this.type = null;
|
14680 | this.stateNode = null;
|
14681 |
|
14682 |
|
14683 | this.return = null;
|
14684 | this.child = null;
|
14685 | this.sibling = null;
|
14686 | this.index = 0;
|
14687 |
|
14688 | this.ref = null;
|
14689 |
|
14690 | this.pendingProps = pendingProps;
|
14691 | this.memoizedProps = null;
|
14692 | this.updateQueue = null;
|
14693 | this.memoizedState = null;
|
14694 | this.dependencies = null;
|
14695 |
|
14696 | this.mode = mode;
|
14697 |
|
14698 |
|
14699 | this.effectTag = NoEffect;
|
14700 | this.nextEffect = null;
|
14701 |
|
14702 | this.firstEffect = null;
|
14703 | this.lastEffect = null;
|
14704 |
|
14705 | this.expirationTime = NoWork;
|
14706 | this.childExpirationTime = NoWork;
|
14707 |
|
14708 | this.alternate = null;
|
14709 |
|
14710 | if (enableProfilerTimer) {
|
14711 |
|
14712 |
|
14713 |
|
14714 |
|
14715 |
|
14716 |
|
14717 |
|
14718 |
|
14719 |
|
14720 |
|
14721 |
|
14722 |
|
14723 | this.actualDuration = Number.NaN;
|
14724 | this.actualStartTime = Number.NaN;
|
14725 | this.selfBaseDuration = Number.NaN;
|
14726 | this.treeBaseDuration = Number.NaN;
|
14727 |
|
14728 |
|
14729 |
|
14730 |
|
14731 | this.actualDuration = 0;
|
14732 | this.actualStartTime = -1;
|
14733 | this.selfBaseDuration = 0;
|
14734 | this.treeBaseDuration = 0;
|
14735 | }
|
14736 |
|
14737 | {
|
14738 | this._debugID = debugCounter++;
|
14739 | this._debugSource = null;
|
14740 | this._debugOwner = null;
|
14741 | this._debugIsCurrentlyTiming = false;
|
14742 | this._debugNeedsRemount = false;
|
14743 | this._debugHookTypes = null;
|
14744 | if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
|
14745 | Object.preventExtensions(this);
|
14746 | }
|
14747 | }
|
14748 | }
|
14749 |
|
14750 |
|
14751 |
|
14752 |
|
14753 |
|
14754 |
|
14755 |
|
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 |
|
14761 |
|
14762 |
|
14763 | var createFiber = function (tag, pendingProps, key, mode) {
|
14764 |
|
14765 | return new FiberNode(tag, pendingProps, key, mode);
|
14766 | };
|
14767 |
|
14768 | function shouldConstruct(Component) {
|
14769 | var prototype = Component.prototype;
|
14770 | return !!(prototype && prototype.isReactComponent);
|
14771 | }
|
14772 |
|
14773 | function isSimpleFunctionComponent(type) {
|
14774 | return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
14775 | }
|
14776 |
|
14777 | function resolveLazyComponentTag(Component) {
|
14778 | if (typeof Component === 'function') {
|
14779 | return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
|
14780 | } else if (Component !== undefined && Component !== null) {
|
14781 | var $$typeof = Component.$$typeof;
|
14782 | if ($$typeof === REACT_FORWARD_REF_TYPE) {
|
14783 | return ForwardRef;
|
14784 | }
|
14785 | if ($$typeof === REACT_MEMO_TYPE) {
|
14786 | return MemoComponent;
|
14787 | }
|
14788 | }
|
14789 | return IndeterminateComponent;
|
14790 | }
|
14791 |
|
14792 |
|
14793 | function createWorkInProgress(current, pendingProps, expirationTime) {
|
14794 | var workInProgress = current.alternate;
|
14795 | if (workInProgress === null) {
|
14796 |
|
14797 |
|
14798 |
|
14799 |
|
14800 |
|
14801 | workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
|
14802 | workInProgress.elementType = current.elementType;
|
14803 | workInProgress.type = current.type;
|
14804 | workInProgress.stateNode = current.stateNode;
|
14805 |
|
14806 | {
|
14807 |
|
14808 | workInProgress._debugID = current._debugID;
|
14809 | workInProgress._debugSource = current._debugSource;
|
14810 | workInProgress._debugOwner = current._debugOwner;
|
14811 | workInProgress._debugHookTypes = current._debugHookTypes;
|
14812 | }
|
14813 |
|
14814 | workInProgress.alternate = current;
|
14815 | current.alternate = workInProgress;
|
14816 | } else {
|
14817 | workInProgress.pendingProps = pendingProps;
|
14818 |
|
14819 |
|
14820 |
|
14821 | workInProgress.effectTag = NoEffect;
|
14822 |
|
14823 |
|
14824 | workInProgress.nextEffect = null;
|
14825 | workInProgress.firstEffect = null;
|
14826 | workInProgress.lastEffect = null;
|
14827 |
|
14828 | if (enableProfilerTimer) {
|
14829 |
|
14830 |
|
14831 |
|
14832 |
|
14833 | workInProgress.actualDuration = 0;
|
14834 | workInProgress.actualStartTime = -1;
|
14835 | }
|
14836 | }
|
14837 |
|
14838 | workInProgress.childExpirationTime = current.childExpirationTime;
|
14839 | workInProgress.expirationTime = current.expirationTime;
|
14840 |
|
14841 | workInProgress.child = current.child;
|
14842 | workInProgress.memoizedProps = current.memoizedProps;
|
14843 | workInProgress.memoizedState = current.memoizedState;
|
14844 | workInProgress.updateQueue = current.updateQueue;
|
14845 |
|
14846 |
|
14847 |
|
14848 | var currentDependencies = current.dependencies;
|
14849 | workInProgress.dependencies = currentDependencies === null ? null : {
|
14850 | expirationTime: currentDependencies.expirationTime,
|
14851 | firstContext: currentDependencies.firstContext,
|
14852 | responders: currentDependencies.responders
|
14853 | };
|
14854 |
|
14855 |
|
14856 | workInProgress.sibling = current.sibling;
|
14857 | workInProgress.index = current.index;
|
14858 | workInProgress.ref = current.ref;
|
14859 |
|
14860 | if (enableProfilerTimer) {
|
14861 | workInProgress.selfBaseDuration = current.selfBaseDuration;
|
14862 | workInProgress.treeBaseDuration = current.treeBaseDuration;
|
14863 | }
|
14864 |
|
14865 | {
|
14866 | workInProgress._debugNeedsRemount = current._debugNeedsRemount;
|
14867 | switch (workInProgress.tag) {
|
14868 | case IndeterminateComponent:
|
14869 | case FunctionComponent:
|
14870 | case SimpleMemoComponent:
|
14871 | workInProgress.type = resolveFunctionForHotReloading(current.type);
|
14872 | break;
|
14873 | case ClassComponent:
|
14874 | workInProgress.type = resolveClassForHotReloading(current.type);
|
14875 | break;
|
14876 | case ForwardRef:
|
14877 | workInProgress.type = resolveForwardRefForHotReloading(current.type);
|
14878 | break;
|
14879 | default:
|
14880 | break;
|
14881 | }
|
14882 | }
|
14883 |
|
14884 | return workInProgress;
|
14885 | }
|
14886 |
|
14887 |
|
14888 | function resetWorkInProgress(workInProgress, renderExpirationTime) {
|
14889 |
|
14890 |
|
14891 |
|
14892 |
|
14893 |
|
14894 |
|
14895 |
|
14896 |
|
14897 |
|
14898 |
|
14899 | workInProgress.effectTag &= Placement;
|
14900 |
|
14901 |
|
14902 | workInProgress.nextEffect = null;
|
14903 | workInProgress.firstEffect = null;
|
14904 | workInProgress.lastEffect = null;
|
14905 |
|
14906 | var current = workInProgress.alternate;
|
14907 | if (current === null) {
|
14908 |
|
14909 | workInProgress.childExpirationTime = NoWork;
|
14910 | workInProgress.expirationTime = renderExpirationTime;
|
14911 |
|
14912 | workInProgress.child = null;
|
14913 | workInProgress.memoizedProps = null;
|
14914 | workInProgress.memoizedState = null;
|
14915 | workInProgress.updateQueue = null;
|
14916 |
|
14917 | workInProgress.dependencies = null;
|
14918 |
|
14919 | if (enableProfilerTimer) {
|
14920 |
|
14921 |
|
14922 | workInProgress.selfBaseDuration = 0;
|
14923 | workInProgress.treeBaseDuration = 0;
|
14924 | }
|
14925 | } else {
|
14926 |
|
14927 | workInProgress.childExpirationTime = current.childExpirationTime;
|
14928 | workInProgress.expirationTime = current.expirationTime;
|
14929 |
|
14930 | workInProgress.child = current.child;
|
14931 | workInProgress.memoizedProps = current.memoizedProps;
|
14932 | workInProgress.memoizedState = current.memoizedState;
|
14933 | workInProgress.updateQueue = current.updateQueue;
|
14934 |
|
14935 |
|
14936 |
|
14937 | var currentDependencies = current.dependencies;
|
14938 | workInProgress.dependencies = currentDependencies === null ? null : {
|
14939 | expirationTime: currentDependencies.expirationTime,
|
14940 | firstContext: currentDependencies.firstContext,
|
14941 | responders: currentDependencies.responders
|
14942 | };
|
14943 |
|
14944 | if (enableProfilerTimer) {
|
14945 |
|
14946 |
|
14947 | workInProgress.selfBaseDuration = current.selfBaseDuration;
|
14948 | workInProgress.treeBaseDuration = current.treeBaseDuration;
|
14949 | }
|
14950 | }
|
14951 |
|
14952 | return workInProgress;
|
14953 | }
|
14954 |
|
14955 | function createHostRootFiber(tag) {
|
14956 | var mode = void 0;
|
14957 | if (tag === ConcurrentRoot) {
|
14958 | mode = ConcurrentMode | BatchedMode | StrictMode;
|
14959 | } else if (tag === BatchedRoot) {
|
14960 | mode = BatchedMode | StrictMode;
|
14961 | } else {
|
14962 | mode = NoMode;
|
14963 | }
|
14964 |
|
14965 | if (enableProfilerTimer && isDevToolsPresent) {
|
14966 |
|
14967 |
|
14968 |
|
14969 | mode |= ProfileMode;
|
14970 | }
|
14971 |
|
14972 | return createFiber(HostRoot, null, null, mode);
|
14973 | }
|
14974 |
|
14975 | function createFiberFromTypeAndProps(type, // React$ElementType
|
14976 | key, pendingProps, owner, mode, expirationTime) {
|
14977 | var fiber = void 0;
|
14978 |
|
14979 | var fiberTag = IndeterminateComponent;
|
14980 |
|
14981 | var resolvedType = type;
|
14982 | if (typeof type === 'function') {
|
14983 | if (shouldConstruct(type)) {
|
14984 | fiberTag = ClassComponent;
|
14985 | {
|
14986 | resolvedType = resolveClassForHotReloading(resolvedType);
|
14987 | }
|
14988 | } else {
|
14989 | {
|
14990 | resolvedType = resolveFunctionForHotReloading(resolvedType);
|
14991 | }
|
14992 | }
|
14993 | } else if (typeof type === 'string') {
|
14994 | fiberTag = HostComponent;
|
14995 | } else {
|
14996 | getTag: switch (type) {
|
14997 | case REACT_FRAGMENT_TYPE:
|
14998 | return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
|
14999 | case REACT_CONCURRENT_MODE_TYPE:
|
15000 | fiberTag = Mode$1;
|
15001 | mode |= ConcurrentMode | BatchedMode | StrictMode;
|
15002 | break;
|
15003 | case REACT_STRICT_MODE_TYPE:
|
15004 | fiberTag = Mode$1;
|
15005 | mode |= StrictMode;
|
15006 | break;
|
15007 | case REACT_PROFILER_TYPE:
|
15008 | return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
|
15009 | case REACT_SUSPENSE_TYPE:
|
15010 | return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
|
15011 | case REACT_SUSPENSE_LIST_TYPE:
|
15012 | return createFiberFromSuspenseList(pendingProps, mode, expirationTime, key);
|
15013 | default:
|
15014 | {
|
15015 | if (typeof type === 'object' && type !== null) {
|
15016 | switch (type.$$typeof) {
|
15017 | case REACT_PROVIDER_TYPE:
|
15018 | fiberTag = ContextProvider;
|
15019 | break getTag;
|
15020 | case REACT_CONTEXT_TYPE:
|
15021 |
|
15022 | fiberTag = ContextConsumer;
|
15023 | break getTag;
|
15024 | case REACT_FORWARD_REF_TYPE:
|
15025 | fiberTag = ForwardRef;
|
15026 | {
|
15027 | resolvedType = resolveForwardRefForHotReloading(resolvedType);
|
15028 | }
|
15029 | break getTag;
|
15030 | case REACT_MEMO_TYPE:
|
15031 | fiberTag = MemoComponent;
|
15032 | break getTag;
|
15033 | case REACT_LAZY_TYPE:
|
15034 | fiberTag = LazyComponent;
|
15035 | resolvedType = null;
|
15036 | break getTag;
|
15037 | case REACT_FUNDAMENTAL_TYPE:
|
15038 | if (enableFundamentalAPI) {
|
15039 | return createFiberFromFundamental(type, pendingProps, mode, expirationTime, key);
|
15040 | }
|
15041 | break;
|
15042 | }
|
15043 | }
|
15044 | var info = '';
|
15045 | {
|
15046 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
15047 | info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.';
|
15048 | }
|
15049 | var ownerName = owner ? getComponentName(owner.type) : null;
|
15050 | if (ownerName) {
|
15051 | info += '\n\nCheck the render method of `' + ownerName + '`.';
|
15052 | }
|
15053 | }
|
15054 | (function () {
|
15055 | {
|
15056 | {
|
15057 | throw ReactError(Error('Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ' + (type == null ? type : typeof type) + '.' + info));
|
15058 | }
|
15059 | }
|
15060 | })();
|
15061 | }
|
15062 | }
|
15063 | }
|
15064 |
|
15065 | fiber = createFiber(fiberTag, pendingProps, key, mode);
|
15066 | fiber.elementType = type;
|
15067 | fiber.type = resolvedType;
|
15068 | fiber.expirationTime = expirationTime;
|
15069 |
|
15070 | return fiber;
|
15071 | }
|
15072 |
|
15073 | function createFiberFromElement(element, mode, expirationTime) {
|
15074 | var owner = null;
|
15075 | {
|
15076 | owner = element._owner;
|
15077 | }
|
15078 | var type = element.type;
|
15079 | var key = element.key;
|
15080 | var pendingProps = element.props;
|
15081 | var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
|
15082 | {
|
15083 | fiber._debugSource = element._source;
|
15084 | fiber._debugOwner = element._owner;
|
15085 | }
|
15086 | return fiber;
|
15087 | }
|
15088 |
|
15089 | function createFiberFromFragment(elements, mode, expirationTime, key) {
|
15090 | var fiber = createFiber(Fragment, elements, key, mode);
|
15091 | fiber.expirationTime = expirationTime;
|
15092 | return fiber;
|
15093 | }
|
15094 |
|
15095 | function createFiberFromFundamental(fundamentalComponent, pendingProps, mode, expirationTime, key) {
|
15096 | var fiber = createFiber(FundamentalComponent, pendingProps, key, mode);
|
15097 | fiber.elementType = fundamentalComponent;
|
15098 | fiber.type = fundamentalComponent;
|
15099 | fiber.expirationTime = expirationTime;
|
15100 | return fiber;
|
15101 | }
|
15102 |
|
15103 | function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
|
15104 | {
|
15105 | if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
|
15106 | warningWithoutStack$1(false, 'Profiler must specify an "id" string and "onRender" function as props');
|
15107 | }
|
15108 | }
|
15109 |
|
15110 | var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
|
15111 |
|
15112 | fiber.elementType = REACT_PROFILER_TYPE;
|
15113 | fiber.type = REACT_PROFILER_TYPE;
|
15114 | fiber.expirationTime = expirationTime;
|
15115 |
|
15116 | return fiber;
|
15117 | }
|
15118 |
|
15119 | function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
|
15120 | var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
|
15121 |
|
15122 |
|
15123 |
|
15124 |
|
15125 | fiber.type = REACT_SUSPENSE_TYPE;
|
15126 | fiber.elementType = REACT_SUSPENSE_TYPE;
|
15127 |
|
15128 | fiber.expirationTime = expirationTime;
|
15129 | return fiber;
|
15130 | }
|
15131 |
|
15132 | function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) {
|
15133 | var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
|
15134 | {
|
15135 |
|
15136 |
|
15137 |
|
15138 | fiber.type = REACT_SUSPENSE_LIST_TYPE;
|
15139 | }
|
15140 | fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
|
15141 | fiber.expirationTime = expirationTime;
|
15142 | return fiber;
|
15143 | }
|
15144 |
|
15145 | function createFiberFromText(content, mode, expirationTime) {
|
15146 | var fiber = createFiber(HostText, content, null, mode);
|
15147 | fiber.expirationTime = expirationTime;
|
15148 | return fiber;
|
15149 | }
|
15150 |
|
15151 | function createFiberFromHostInstanceForDeletion() {
|
15152 | var fiber = createFiber(HostComponent, null, null, NoMode);
|
15153 |
|
15154 | fiber.elementType = 'DELETED';
|
15155 | fiber.type = 'DELETED';
|
15156 | return fiber;
|
15157 | }
|
15158 |
|
15159 | function createFiberFromPortal(portal, mode, expirationTime) {
|
15160 | var pendingProps = portal.children !== null ? portal.children : [];
|
15161 | var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
|
15162 | fiber.expirationTime = expirationTime;
|
15163 | fiber.stateNode = {
|
15164 | containerInfo: portal.containerInfo,
|
15165 | pendingChildren: null,
|
15166 | implementation: portal.implementation
|
15167 | };
|
15168 | return fiber;
|
15169 | }
|
15170 |
|
15171 |
|
15172 | function assignFiberPropertiesInDEV(target, source) {
|
15173 | if (target === null) {
|
15174 |
|
15175 |
|
15176 | target = createFiber(IndeterminateComponent, null, null, NoMode);
|
15177 | }
|
15178 |
|
15179 |
|
15180 |
|
15181 |
|
15182 |
|
15183 |
|
15184 |
|
15185 | target.tag = source.tag;
|
15186 | target.key = source.key;
|
15187 | target.elementType = source.elementType;
|
15188 | target.type = source.type;
|
15189 | target.stateNode = source.stateNode;
|
15190 | target.return = source.return;
|
15191 | target.child = source.child;
|
15192 | target.sibling = source.sibling;
|
15193 | target.index = source.index;
|
15194 | target.ref = source.ref;
|
15195 | target.pendingProps = source.pendingProps;
|
15196 | target.memoizedProps = source.memoizedProps;
|
15197 | target.updateQueue = source.updateQueue;
|
15198 | target.memoizedState = source.memoizedState;
|
15199 | target.dependencies = source.dependencies;
|
15200 | target.mode = source.mode;
|
15201 | target.effectTag = source.effectTag;
|
15202 | target.nextEffect = source.nextEffect;
|
15203 | target.firstEffect = source.firstEffect;
|
15204 | target.lastEffect = source.lastEffect;
|
15205 | target.expirationTime = source.expirationTime;
|
15206 | target.childExpirationTime = source.childExpirationTime;
|
15207 | target.alternate = source.alternate;
|
15208 | if (enableProfilerTimer) {
|
15209 | target.actualDuration = source.actualDuration;
|
15210 | target.actualStartTime = source.actualStartTime;
|
15211 | target.selfBaseDuration = source.selfBaseDuration;
|
15212 | target.treeBaseDuration = source.treeBaseDuration;
|
15213 | }
|
15214 | target._debugID = source._debugID;
|
15215 | target._debugSource = source._debugSource;
|
15216 | target._debugOwner = source._debugOwner;
|
15217 | target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
|
15218 | target._debugNeedsRemount = source._debugNeedsRemount;
|
15219 | target._debugHookTypes = source._debugHookTypes;
|
15220 | return target;
|
15221 | }
|
15222 |
|
15223 |
|
15224 |
|
15225 |
|
15226 |
|
15227 |
|
15228 |
|
15229 |
|
15230 |
|
15231 |
|
15232 |
|
15233 |
|
15234 |
|
15235 |
|
15236 |
|
15237 |
|
15238 |
|
15239 | function FiberRootNode(containerInfo, tag, hydrate) {
|
15240 | this.tag = tag;
|
15241 | this.current = null;
|
15242 | this.containerInfo = containerInfo;
|
15243 | this.pendingChildren = null;
|
15244 | this.pingCache = null;
|
15245 | this.finishedExpirationTime = NoWork;
|
15246 | this.finishedWork = null;
|
15247 | this.timeoutHandle = noTimeout;
|
15248 | this.context = null;
|
15249 | this.pendingContext = null;
|
15250 | this.hydrate = hydrate;
|
15251 | this.firstBatch = null;
|
15252 | this.callbackNode = null;
|
15253 | this.callbackExpirationTime = NoWork;
|
15254 | this.firstPendingTime = NoWork;
|
15255 | this.lastPendingTime = NoWork;
|
15256 | this.pingTime = NoWork;
|
15257 |
|
15258 | if (enableSchedulerTracing) {
|
15259 | this.interactionThreadID = tracing.unstable_getThreadID();
|
15260 | this.memoizedInteractions = new Set();
|
15261 | this.pendingInteractionMap = new Map();
|
15262 | }
|
15263 | }
|
15264 |
|
15265 | function createFiberRoot(containerInfo, tag, hydrate) {
|
15266 | var root = new FiberRootNode(containerInfo, tag, hydrate);
|
15267 |
|
15268 |
|
15269 |
|
15270 | var uninitializedFiber = createHostRootFiber(tag);
|
15271 | root.current = uninitializedFiber;
|
15272 | uninitializedFiber.stateNode = root;
|
15273 |
|
15274 | return root;
|
15275 | }
|
15276 |
|
15277 |
|
15278 |
|
15279 |
|
15280 |
|
15281 | var ReactFiberInstrumentation = {
|
15282 | debugTool: null
|
15283 | };
|
15284 |
|
15285 | var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
|
15286 |
|
15287 |
|
15288 |
|
15289 |
|
15290 |
|
15291 | var didWarnAboutNestedUpdates = void 0;
|
15292 | {
|
15293 | didWarnAboutNestedUpdates = false;
|
15294 |
|
15295 | }
|
15296 |
|
15297 | function getContextForSubtree(parentComponent) {
|
15298 | if (!parentComponent) {
|
15299 | return emptyContextObject;
|
15300 | }
|
15301 |
|
15302 | var fiber = get(parentComponent);
|
15303 | var parentContext = findCurrentUnmaskedContext(fiber);
|
15304 |
|
15305 | if (fiber.tag === ClassComponent) {
|
15306 | var Component = fiber.type;
|
15307 | if (isContextProvider(Component)) {
|
15308 | return processChildContext(fiber, Component, parentContext);
|
15309 | }
|
15310 | }
|
15311 |
|
15312 | return parentContext;
|
15313 | }
|
15314 |
|
15315 | function scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback) {
|
15316 | {
|
15317 | if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
|
15318 | didWarnAboutNestedUpdates = true;
|
15319 | warningWithoutStack$1(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
|
15320 | }
|
15321 | }
|
15322 |
|
15323 | var update = createUpdate(expirationTime, suspenseConfig);
|
15324 |
|
15325 |
|
15326 | update.payload = { element: element };
|
15327 |
|
15328 | callback = callback === undefined ? null : callback;
|
15329 | if (callback !== null) {
|
15330 | !(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
|
15331 | update.callback = callback;
|
15332 | }
|
15333 |
|
15334 | if (revertPassiveEffectsChange) {
|
15335 | flushPassiveEffects();
|
15336 | }
|
15337 | enqueueUpdate(current$$1, update);
|
15338 | scheduleWork(current$$1, expirationTime);
|
15339 |
|
15340 | return expirationTime;
|
15341 | }
|
15342 |
|
15343 | function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
|
15344 |
|
15345 | var current$$1 = container.current;
|
15346 |
|
15347 | {
|
15348 | if (ReactFiberInstrumentation_1.debugTool) {
|
15349 | if (current$$1.alternate === null) {
|
15350 | ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
|
15351 | } else if (element === null) {
|
15352 | ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
|
15353 | } else {
|
15354 | ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
|
15355 | }
|
15356 | }
|
15357 | }
|
15358 |
|
15359 | var context = getContextForSubtree(parentComponent);
|
15360 | if (container.context === null) {
|
15361 | container.context = context;
|
15362 | } else {
|
15363 | container.pendingContext = context;
|
15364 | }
|
15365 |
|
15366 | return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
|
15367 | }
|
15368 |
|
15369 | function createContainer(containerInfo, tag, hydrate) {
|
15370 | return createFiberRoot(containerInfo, tag, hydrate);
|
15371 | }
|
15372 |
|
15373 | function updateContainer(element, container, parentComponent, callback) {
|
15374 | var current$$1 = container.current;
|
15375 | var currentTime = requestCurrentTime();
|
15376 | {
|
15377 |
|
15378 | if ('undefined' !== typeof jest) {
|
15379 | warnIfUnmockedScheduler(current$$1);
|
15380 | warnIfNotScopedWithMatchingAct(current$$1);
|
15381 | }
|
15382 | }
|
15383 | var suspenseConfig = requestCurrentSuspenseConfig();
|
15384 | var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
|
15385 | return updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback);
|
15386 | }
|
15387 |
|
15388 |
|
15389 |
|
15390 |
|
15391 |
|
15392 | var shouldSuspendImpl = function (fiber) {
|
15393 | return false;
|
15394 | };
|
15395 |
|
15396 | function shouldSuspend(fiber) {
|
15397 | return shouldSuspendImpl(fiber);
|
15398 | }
|
15399 |
|
15400 | var overrideHookState = null;
|
15401 | var overrideProps = null;
|
15402 | var scheduleUpdate = null;
|
15403 | var setSuspenseHandler = null;
|
15404 |
|
15405 | {
|
15406 | var copyWithSetImpl = function (obj, path, idx, value) {
|
15407 | if (idx >= path.length) {
|
15408 | return value;
|
15409 | }
|
15410 | var key = path[idx];
|
15411 | var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
|
15412 |
|
15413 | updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
|
15414 | return updated;
|
15415 | };
|
15416 |
|
15417 | var copyWithSet = function (obj, path, value) {
|
15418 | return copyWithSetImpl(obj, path, 0, value);
|
15419 | };
|
15420 |
|
15421 |
|
15422 | overrideHookState = function (fiber, id, path, value) {
|
15423 |
|
15424 |
|
15425 | var currentHook = fiber.memoizedState;
|
15426 | while (currentHook !== null && id > 0) {
|
15427 | currentHook = currentHook.next;
|
15428 | id--;
|
15429 | }
|
15430 | if (currentHook !== null) {
|
15431 | if (revertPassiveEffectsChange) {
|
15432 | flushPassiveEffects();
|
15433 | }
|
15434 |
|
15435 | var newState = copyWithSet(currentHook.memoizedState, path, value);
|
15436 | currentHook.memoizedState = newState;
|
15437 | currentHook.baseState = newState;
|
15438 |
|
15439 |
|
15440 |
|
15441 |
|
15442 |
|
15443 |
|
15444 | fiber.memoizedProps = _assign({}, fiber.memoizedProps);
|
15445 |
|
15446 | scheduleWork(fiber, Sync);
|
15447 | }
|
15448 | };
|
15449 |
|
15450 |
|
15451 | overrideProps = function (fiber, path, value) {
|
15452 | if (revertPassiveEffectsChange) {
|
15453 | flushPassiveEffects();
|
15454 | }
|
15455 | fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
|
15456 | if (fiber.alternate) {
|
15457 | fiber.alternate.pendingProps = fiber.pendingProps;
|
15458 | }
|
15459 | scheduleWork(fiber, Sync);
|
15460 | };
|
15461 |
|
15462 | scheduleUpdate = function (fiber) {
|
15463 | if (revertPassiveEffectsChange) {
|
15464 | flushPassiveEffects();
|
15465 | }
|
15466 | scheduleWork(fiber, Sync);
|
15467 | };
|
15468 |
|
15469 | setSuspenseHandler = function (newShouldSuspendImpl) {
|
15470 | shouldSuspendImpl = newShouldSuspendImpl;
|
15471 | };
|
15472 | }
|
15473 |
|
15474 | function injectIntoDevTools(devToolsConfig) {
|
15475 | var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
|
15476 | var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
15477 |
|
15478 |
|
15479 | return injectInternals(_assign({}, devToolsConfig, {
|
15480 | overrideHookState: overrideHookState,
|
15481 | overrideProps: overrideProps,
|
15482 | setSuspenseHandler: setSuspenseHandler,
|
15483 | scheduleUpdate: scheduleUpdate,
|
15484 | currentDispatcherRef: ReactCurrentDispatcher,
|
15485 | findHostInstanceByFiber: function (fiber) {
|
15486 | var hostFiber = findCurrentHostFiber(fiber);
|
15487 | if (hostFiber === null) {
|
15488 | return null;
|
15489 | }
|
15490 | return hostFiber.stateNode;
|
15491 | },
|
15492 | findFiberByHostInstance: function (instance) {
|
15493 | if (!findFiberByHostInstance) {
|
15494 |
|
15495 | return null;
|
15496 | }
|
15497 | return findFiberByHostInstance(instance);
|
15498 | },
|
15499 |
|
15500 |
|
15501 | findHostInstancesForRefresh: findHostInstancesForRefresh,
|
15502 | scheduleRefresh: scheduleRefresh,
|
15503 | scheduleRoot: scheduleRoot,
|
15504 | setRefreshHandler: setRefreshHandler,
|
15505 |
|
15506 | getCurrentFiber: function () {
|
15507 | return current;
|
15508 | }
|
15509 | }));
|
15510 | }
|
15511 |
|
15512 |
|
15513 |
|
15514 |
|
15515 | var _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
15516 |
|
15517 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
15518 |
|
15519 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
15520 |
|
15521 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15522 |
|
15523 | Mode.setCurrent(
|
15524 |
|
15525 | FastNoSideEffects);
|
15526 |
|
15527 |
|
15528 |
|
15529 | var slice = Array.prototype.slice;
|
15530 |
|
15531 | var LinearGradient = function () {
|
15532 | function LinearGradient(stops, x1, y1, x2, y2) {
|
15533 | _classCallCheck(this, LinearGradient);
|
15534 |
|
15535 | this._args = slice.call(arguments);
|
15536 | }
|
15537 |
|
15538 | LinearGradient.prototype.applyFill = function applyFill(node) {
|
15539 | node.fillLinear.apply(node, this._args);
|
15540 | };
|
15541 |
|
15542 | return LinearGradient;
|
15543 | }();
|
15544 |
|
15545 | var RadialGradient = function () {
|
15546 | function RadialGradient(stops, fx, fy, rx, ry, cx, cy) {
|
15547 | _classCallCheck(this, RadialGradient);
|
15548 |
|
15549 | this._args = slice.call(arguments);
|
15550 | }
|
15551 |
|
15552 | RadialGradient.prototype.applyFill = function applyFill(node) {
|
15553 | node.fillRadial.apply(node, this._args);
|
15554 | };
|
15555 |
|
15556 | return RadialGradient;
|
15557 | }();
|
15558 |
|
15559 | var Pattern = function () {
|
15560 | function Pattern(url, width, height, left, top) {
|
15561 | _classCallCheck(this, Pattern);
|
15562 |
|
15563 | this._args = slice.call(arguments);
|
15564 | }
|
15565 |
|
15566 | Pattern.prototype.applyFill = function applyFill(node) {
|
15567 | node.fillImage.apply(node, this._args);
|
15568 | };
|
15569 |
|
15570 | return Pattern;
|
15571 | }();
|
15572 |
|
15573 |
|
15574 |
|
15575 | var Surface = function (_React$Component) {
|
15576 | _inherits(Surface, _React$Component);
|
15577 |
|
15578 | function Surface() {
|
15579 | _classCallCheck(this, Surface);
|
15580 |
|
15581 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
15582 | }
|
15583 |
|
15584 | Surface.prototype.componentDidMount = function componentDidMount() {
|
15585 | var _props = this.props,
|
15586 | height = _props.height,
|
15587 | width = _props.width;
|
15588 |
|
15589 |
|
15590 | this._surface = Mode.Surface(+width, +height, this._tagRef);
|
15591 |
|
15592 | this._mountNode = createContainer(this._surface, LegacyRoot, false);
|
15593 | updateContainer(this.props.children, this._mountNode, this);
|
15594 | };
|
15595 |
|
15596 | Surface.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
15597 | var props = this.props;
|
15598 |
|
15599 | if (props.height !== prevProps.height || props.width !== prevProps.width) {
|
15600 | this._surface.resize(+props.width, +props.height);
|
15601 | }
|
15602 |
|
15603 | updateContainer(this.props.children, this._mountNode, this);
|
15604 |
|
15605 | if (this._surface.render) {
|
15606 | this._surface.render();
|
15607 | }
|
15608 | };
|
15609 |
|
15610 | Surface.prototype.componentWillUnmount = function componentWillUnmount() {
|
15611 | updateContainer(null, this._mountNode, this);
|
15612 | };
|
15613 |
|
15614 | Surface.prototype.render = function render() {
|
15615 | var _this2 = this;
|
15616 |
|
15617 |
|
15618 |
|
15619 |
|
15620 |
|
15621 | var props = this.props;
|
15622 |
|
15623 |
|
15624 | var Tag = Mode.Surface.tagName;
|
15625 |
|
15626 | return React.createElement(Tag, {
|
15627 | ref: function (ref) {
|
15628 | return _this2._tagRef = ref;
|
15629 | },
|
15630 | accessKey: props.accessKey,
|
15631 | className: props.className,
|
15632 | draggable: props.draggable,
|
15633 | role: props.role,
|
15634 | style: props.style,
|
15635 | tabIndex: props.tabIndex,
|
15636 | title: props.title
|
15637 | });
|
15638 | };
|
15639 |
|
15640 | return Surface;
|
15641 | }(React.Component);
|
15642 |
|
15643 | var Text = function (_React$Component2) {
|
15644 | _inherits(Text, _React$Component2);
|
15645 |
|
15646 | function Text(props) {
|
15647 | _classCallCheck(this, Text);
|
15648 |
|
15649 |
|
15650 |
|
15651 | var _this3 = _possibleConstructorReturn(this, _React$Component2.call(this, props));
|
15652 |
|
15653 | ['height', 'width', 'x', 'y'].forEach(function (key) {
|
15654 | Object.defineProperty(_this3, key, {
|
15655 | get: function () {
|
15656 | return this._text ? this._text[key] : undefined;
|
15657 | }
|
15658 | });
|
15659 | });
|
15660 | return _this3;
|
15661 | }
|
15662 |
|
15663 | Text.prototype.render = function render() {
|
15664 | var _this4 = this;
|
15665 |
|
15666 |
|
15667 | var T = TYPES.TEXT;
|
15668 | return React.createElement(
|
15669 | T,
|
15670 | _extends({}, this.props, { ref: function (t) {
|
15671 | return _this4._text = t;
|
15672 | } }),
|
15673 | childrenAsString(this.props.children)
|
15674 | );
|
15675 | };
|
15676 |
|
15677 | return Text;
|
15678 | }(React.Component);
|
15679 |
|
15680 | injectIntoDevTools({
|
15681 | findFiberByHostInstance: function () {
|
15682 | return null;
|
15683 | },
|
15684 | bundleType: 1,
|
15685 | version: ReactVersion,
|
15686 | rendererPackageName: 'react-art'
|
15687 | });
|
15688 |
|
15689 |
|
15690 |
|
15691 | var ClippingRectangle = TYPES.CLIPPING_RECTANGLE;
|
15692 | var Group = TYPES.GROUP;
|
15693 | var Shape = TYPES.SHAPE;
|
15694 | var Path = Mode.Path;
|
15695 |
|
15696 |
|
15697 | var ReactART = Object.freeze({
|
15698 | ClippingRectangle: ClippingRectangle,
|
15699 | Group: Group,
|
15700 | Shape: Shape,
|
15701 | Path: Path,
|
15702 | LinearGradient: LinearGradient,
|
15703 | Pattern: Pattern,
|
15704 | RadialGradient: RadialGradient,
|
15705 | Surface: Surface,
|
15706 | Text: Text,
|
15707 | Transform: Transform
|
15708 | });
|
15709 |
|
15710 | var reactArt = ReactART;
|
15711 |
|
15712 | module.exports = reactArt;
|
15713 | })();
|
15714 | }
|