Add Offscreen stateNode#24026
Conversation
| import type {ReactNodeList, OffscreenMode} from 'shared/ReactTypes'; | ||
| import type {Lanes} from './ReactFiberLane.old'; | ||
| import type {SpawnedCachePool} from './ReactFiberCacheComponent.new'; | ||
| import {number} from 'prop-types'; |
There was a problem hiding this comment.
Don't need this. Maybe this was an auto-import?
| |}; | ||
|
|
||
| export type OffscreenInstance = {| | ||
| id: number, |
There was a problem hiding this comment.
Can you leave this as an empty object for now? Not convinced yet we need to have a numeric id, since we can use the object itself as a key. But even if we do, we can figure that out in the next PR.
| fallbackChildFragment.flags |= Placement; | ||
| } | ||
|
|
||
| primaryChildFragment.stateNode = current.stateNode; |
There was a problem hiding this comment.
You don't need to copy this. It's copied during createWorkInProgress.
914a54f to
bd227e0
Compare
| ); | ||
| } | ||
|
|
||
| primaryChildFragment.stateNode = primaryChildInstance; |
There was a problem hiding this comment.
I think you also need to do this in updateOffscreenComponent, because once <Offscreen /> is a public API, it won't have been rendered by a Suspense parent that initializes the instance here.
But it might be best to do it in createOffscreenFiber:
That's where HostPortal initializes its instance
bd227e0 to
4cd1c2e
Compare
|
Comparing: cb1e7b1...4cd1c2e Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
Summary: This sync includes the following changes: - **[3f89908](react/react@3f8990898 )**: Fix test-build-devtools if build was generated by build-for-devtools ([#24088](react/react#24088)) //<Sebastian Silbermann>// - **[577f2de](react/react@577f2de46 )**: enableCacheElement flag ([#24131](react/react#24131)) //<David McCabe>// - **[2e0d86d](react/react@2e0d86d22 )**: Allow updating dehydrated root at lower priority without forcing client render ([#24082](react/react#24082)) //<Andrew Clark>// - **[dbe9e73](react/react@dbe9e732a )**: Avoid conditions where control flow is sufficient ([#24126](react/react#24126)) //<Sebastian Markbåge>// - **[b075f97](react/react@b075f9742 )**: Fix dispatch config type for skipBubbling ([#24109](react/react#24109)) //<Luna>// - **[ef23a9e](react/react@ef23a9ee8 )**: Flag for text hydration mismatch ([#24107](react/react#24107)) //<salazarm>// - **[0412f0c](react/react@0412f0c1a )**: add offscreen state node ([#24026](react/react#24026)) //<Luna Ruan>// - **[43eb283](react/react@43eb28339 )**: Add skipBubbling property to dispatch config ([#23366](react/react#23366)) //<Luna>// - **[832e298](react/react@832e2987e )**: Revert accdientally merged PR ([#24081](react/react#24081)) //<Andrew Clark>// - **[02b65fd](react/react@02b65fd8c )**: Allow updates at lower pri without forcing client render //<Andrew Clark>// - **[83b941a](react/react@83b941a51 )**: Add isRootDehydrated function //<Andrew Clark>// - **[c8e4789](react/react@c8e4789e2 )**: Pass children to hydration root constructor //<Andrew Clark>// - **[581f0c4](react/react@581f0c42e )**: [Flight] add support for Lazy components in Flight server ([#24068](react/react#24068)) //<Josh Story>// - **[72a933d](react/react@72a933d28 )**: Gate legacy hidden ([#24047](react/react#24047)) //<Sebastian Markbåge>// - **[b9de50d](react/react@b9de50d2f )**: Update test to reset modules instead of using private state ([#24055](react/react#24055)) //<Sebastian Markbåge>// - **[c91892e](react/react@c91892ec3 )**: [Fizz] Don't flush empty segments ([#24054](react/react#24054)) //<Sebastian Markbåge>// - **[d5f1b06](react/react@d5f1b067c )**: [ServerContext] Flight support for ServerContext ([#23244](react/react#23244)) //<salazarm>// - **[6edd55a](react/react@6edd55a3f )**: Gate unstable_expectedLoadTime on enableCPUSuspense ([#24038](react/react#24038)) //<Sebastian Markbåge>// - **[57799b9](react/react@57799b912 )**: Add more feature flag checks ([#24037](react/react#24037)) //<Sebastian Markbåge>// - **[e09518e](react/react@e09518e5b )**: [Fizz] write chunks to a buffer with no re-use ([#24034](react/react#24034)) //<Josh Story>// - **[14c2be8](react/react@14c2be8da )**: Rename Node SSR Callbacks to onShellReady/onAllReady and Other Fixes ([#24030](react/react#24030)) //<Sebastian Markbåge>// - **[cb1e7b1](react/react@cb1e7b1c6 )**: Move onCompleteAll to .allReady Promise ([#24025](react/react#24025)) //<Sebastian Markbåge>// - **[5662857](react/react@566285761 )**: [Fizz] Export debug function for FB ([#24024](react/react#24024)) //<salazarm>// - **[05c283c](react/react@05c283c3c )**: Fabric HostComponent as EventEmitter: support add/removeEventListener (unstable only) ([#23386](react/react#23386)) //<Joshua Gross>// - **[0864434](react/react@08644348b )**: Added unit Tests in the ReactART, increasing the code coverage ([#23195](react/react#23195)) //<BIKI DAS>// - **[feefe43](react/react@feefe437f )**: Refactor Cache Code ([#23393](react/react#23393)) //<Luna Ruan>// Changelog: [General][Changed] - React Native sync for revisions 1780659...1159ff6 jest_e2e[run_all_tests] Reviewed By: lunaleaps Differential Revision: D34928167 fbshipit-source-id: 8c386f2be5871981d217ab9a514892ed88eafcfb
Add state node on Offscreen fibers with id (in preparation for transition tracing)
Summary: This sync includes the following changes: - **[3f89908](react/react@3f8990898 )**: Fix test-build-devtools if build was generated by build-for-devtools ([react#24088](react/react#24088)) //<Sebastian Silbermann>// - **[577f2de](react/react@577f2de46 )**: enableCacheElement flag ([react#24131](react/react#24131)) //<David McCabe>// - **[2e0d86d](react/react@2e0d86d22 )**: Allow updating dehydrated root at lower priority without forcing client render ([react#24082](react/react#24082)) //<Andrew Clark>// - **[dbe9e73](react/react@dbe9e732a )**: Avoid conditions where control flow is sufficient ([react#24126](react/react#24126)) //<Sebastian Markbåge>// - **[b075f97](react/react@b075f9742 )**: Fix dispatch config type for skipBubbling ([react#24109](react/react#24109)) //<Luna>// - **[ef23a9e](react/react@ef23a9ee8 )**: Flag for text hydration mismatch ([react#24107](react/react#24107)) //<salazarm>// - **[0412f0c](react/react@0412f0c1a )**: add offscreen state node ([react#24026](react/react#24026)) //<Luna Ruan>// - **[43eb283](react/react@43eb28339 )**: Add skipBubbling property to dispatch config ([react#23366](react/react#23366)) //<Luna>// - **[832e298](react/react@832e2987e )**: Revert accdientally merged PR ([react#24081](react/react#24081)) //<Andrew Clark>// - **[02b65fd](react/react@02b65fd8c )**: Allow updates at lower pri without forcing client render //<Andrew Clark>// - **[83b941a](react/react@83b941a51 )**: Add isRootDehydrated function //<Andrew Clark>// - **[c8e4789](react/react@c8e4789e2 )**: Pass children to hydration root constructor //<Andrew Clark>// - **[581f0c4](react/react@581f0c42e )**: [Flight] add support for Lazy components in Flight server ([react#24068](react/react#24068)) //<Josh Story>// - **[72a933d](react/react@72a933d28 )**: Gate legacy hidden ([react#24047](react/react#24047)) //<Sebastian Markbåge>// - **[b9de50d](react/react@b9de50d2f )**: Update test to reset modules instead of using private state ([react#24055](react/react#24055)) //<Sebastian Markbåge>// - **[c91892e](react/react@c91892ec3 )**: [Fizz] Don't flush empty segments ([react#24054](react/react#24054)) //<Sebastian Markbåge>// - **[d5f1b06](react/react@d5f1b067c )**: [ServerContext] Flight support for ServerContext ([react#23244](react/react#23244)) //<salazarm>// - **[6edd55a](react/react@6edd55a3f )**: Gate unstable_expectedLoadTime on enableCPUSuspense ([react#24038](react/react#24038)) //<Sebastian Markbåge>// - **[57799b9](react/react@57799b912 )**: Add more feature flag checks ([react#24037](react/react#24037)) //<Sebastian Markbåge>// - **[e09518e](react/react@e09518e5b )**: [Fizz] write chunks to a buffer with no re-use ([react#24034](react/react#24034)) //<Josh Story>// - **[14c2be8](react/react@14c2be8da )**: Rename Node SSR Callbacks to onShellReady/onAllReady and Other Fixes ([react#24030](react/react#24030)) //<Sebastian Markbåge>// - **[cb1e7b1](react/react@cb1e7b1c6 )**: Move onCompleteAll to .allReady Promise ([react#24025](react/react#24025)) //<Sebastian Markbåge>// - **[5662857](react/react@566285761 )**: [Fizz] Export debug function for FB ([react#24024](react/react#24024)) //<salazarm>// - **[05c283c](react/react@05c283c3c )**: Fabric HostComponent as EventEmitter: support add/removeEventListener (unstable only) ([react#23386](react/react#23386)) //<Joshua Gross>// - **[0864434](react/react@08644348b )**: Added unit Tests in the ReactART, increasing the code coverage ([react#23195](react/react#23195)) //<BIKI DAS>// - **[feefe43](react/react@feefe437f )**: Refactor Cache Code ([react#23393](react/react#23393)) //<Luna Ruan>// Changelog: [General][Changed] - React Native sync for revisions 1780659...1159ff6 jest_e2e[run_all_tests] Reviewed By: lunaleaps Differential Revision: D34928167 fbshipit-source-id: 8c386f2be5871981d217ab9a514892ed88eafcfb
Add state node on Offscreen fibers with id (in preparation for transition tracing)