dillon1000/react
Commit
Browse files Reconcile element types of lazy component yielding the same type (#20357)
* Reconcile element types of lazy component yielding the same type * Add some legacy mode and suspense boundary flushing tests * Fix infinite loop in legacy mode In legacy mode we typically commit the suspending fiber and then rerender the nearest boundary to render the fallback in a separate commit. We can't do that when the boundary itself suspends because when we try to do the second pass, it'll suspend again and infinite loop. Interestingly the legacy semantics are not needed in this case because they exist to let an existing partial render fully commit its partial state. In this case there's no partial state, so we can just render the fallback immediately instead. * Check fast refresh compatibility first resolveLazy can suspend and if it does, it can resuspend. Fast refresh assumes that we don't resuspend. Instead it relies on updating the inner component later. * Use timers instead of act to force fallbacks to show
Changed paths5 files
First-parent comparisonpackages/react-reconciler/src/ReactChildFiber.new.js ModifiedM packages/react-reconciler/src/ReactChildFiber.old.js ModifiedM packages/react-reconciler/src/ReactFiberThrow.new.js ModifiedM packages/react-reconciler/src/ReactFiberThrow.old.js ModifiedM packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…