-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Trying to remove non-present child list" error occurred with specific use-case #35871
Comments
@NickGerleman |
It looks like, unlike cells rendered by This means the logic for registering/unregistering nested children does not work correctly when a VirtualizedList is present as part of There should be a relatively straightforward fix, but in the meantime a simple workaround would be to avoid nesting a FlatList as part of the ListEmptyComponent. |
…Component Summary: Fixes facebook#35871 Nested VirtualizedLists register to their parents for updates, associated to a specfific cellKey set by VirtualizedListCellContextProvider. This cellKey is usually set when rendering a cell for a data item, but we can also render a nested VirtualizedList by putting one in a ListHeaderComponent/ListFooterComponent/ListEmptyComponent. D6603342 (facebook@a010a0c) added cellKeys when we render from a header/footer, but not ListEmptyComponent, so that association would silently fail earlier. D39466677 (facebook@010da67) added extra invariants to child list handling, that are now triggered by this case, complaining because we are trying to unregister a child list we never successfully registered, due to a missing cellKey. This fixes the issue by providing a cellKey for ListEmptyComponent as well. It also cleans up some of the parameterization needed from when we had two VirtualizedList implementations. Changelog: [General][Fixed] - Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent Differential Revision: D42574462 fbshipit-source-id: 4d7817fa6298ca1ef1b0c5977f19f6b68123db8b
…Component (facebook#35875) Summary: Pull Request resolved: facebook#35875 Fixes facebook#35871 Nested VirtualizedLists register to their parents for updates, associated to a specfific cellKey set by VirtualizedListCellContextProvider. This cellKey is usually set when rendering a cell for a data item, but we can also render a nested VirtualizedList by putting one in a ListHeaderComponent/ListFooterComponent/ListEmptyComponent. D6603342 (facebook@a010a0c) added cellKeys when we render from a header/footer, but not ListEmptyComponent, so that association would silently fail earlier. D39466677 (facebook@010da67) added extra invariants to child list handling, that are now triggered by this case, complaining because we are trying to unregister a child list we never successfully registered, due to a missing cellKey. This fixes the issue by providing a cellKey for ListEmptyComponent as well. It also cleans up some of the parameterization needed from when we had two VirtualizedList implementations. Changelog: [General][Fixed] - Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent Differential Revision: D42574462 fbshipit-source-id: dfec4981aaaa92b2525779b0f6c643688752fd04
…Component (facebook#35875) Summary: Pull Request resolved: facebook#35875 Fixes facebook#35871 Nested VirtualizedLists register to their parents for updates, associated to a specfific cellKey set by VirtualizedListCellContextProvider. This cellKey is usually set when rendering a cell for a data item, but we can also render a nested VirtualizedList by putting one in a ListHeaderComponent/ListFooterComponent/ListEmptyComponent. D6603342 (facebook@a010a0c) added cellKeys when we render from a header/footer, but not ListEmptyComponent, so that association would silently fail earlier. D39466677 (facebook@010da67) added extra invariants to child list handling, that are now triggered by this case, complaining because we are trying to unregister a child list we never successfully registered, due to a missing cellKey. This fixes the issue by providing a cellKey for ListEmptyComponent as well. It also cleans up some of the parameterization needed from when we had two VirtualizedList implementations. Changelog: [General][Fixed] - Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent Differential Revision: D42574462 fbshipit-source-id: 496db5145616c2149584f74957fc6027c2ac0d3a
…Component (facebook#35875) Summary: Pull Request resolved: facebook#35875 Fixes facebook#35871 Nested VirtualizedLists register to their parents for updates, associated to a specfific cellKey set by VirtualizedListCellContextProvider. This cellKey is usually set when rendering a cell for a data item, but we can also render a nested VirtualizedList by putting one in a ListHeaderComponent/ListFooterComponent/ListEmptyComponent. D6603342 (facebook@a010a0c) added cellKeys when we render from a header/footer, but not ListEmptyComponent, so that association would silently fail earlier. D39466677 (facebook@010da67) added extra invariants to child list handling, that are now triggered by this case, complaining because we are trying to unregister a child list we never successfully registered, due to a missing cellKey. This fixes the issue by providing a cellKey for ListEmptyComponent as well. Changelog: [General][Fixed] - Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent Differential Revision: D42574462 fbshipit-source-id: 99b51f891737eeb8b3b58b94aa6d4fd04a35d12d
…Component (#35875) Summary: Pull Request resolved: #35875 Fixes #35871 Nested VirtualizedLists register to their parents for updates, associated to a specfific cellKey set by VirtualizedListCellContextProvider. This cellKey is usually set when rendering a cell for a data item, but we can also render a nested VirtualizedList by putting one in a ListHeaderComponent/ListFooterComponent/ListEmptyComponent. D6603342 (a010a0c) added cellKeys when we render from a header/footer, but not ListEmptyComponent, so that association would silently fail earlier. D39466677 (010da67) added extra invariants to child list handling, that are now triggered by this case, complaining because we are trying to unregister a child list we never successfully registered, due to a missing cellKey. This fixes the issue by providing a cellKey for ListEmptyComponent as well. Changelog: [General][Fixed] - Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent Reviewed By: christophpurrer Differential Revision: D42574462 fbshipit-source-id: f76fa795bf471cb8a929c2efdbd814ea51927663 # Conflicts: # Libraries/Lists/VirtualizedList.js
…Component (facebook#35875) Summary: Pull Request resolved: facebook#35875 Fixes facebook#35871 Nested VirtualizedLists register to their parents for updates, associated to a specfific cellKey set by VirtualizedListCellContextProvider. This cellKey is usually set when rendering a cell for a data item, but we can also render a nested VirtualizedList by putting one in a ListHeaderComponent/ListFooterComponent/ListEmptyComponent. D6603342 (facebook@a010a0c) added cellKeys when we render from a header/footer, but not ListEmptyComponent, so that association would silently fail earlier. D39466677 (facebook@010da67) added extra invariants to child list handling, that are now triggered by this case, complaining because we are trying to unregister a child list we never successfully registered, due to a missing cellKey. This fixes the issue by providing a cellKey for ListEmptyComponent as well. Changelog: [General][Fixed] - Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent Reviewed By: christophpurrer Differential Revision: D42574462 fbshipit-source-id: f76fa795bf471cb8a929c2efdbd814ea51927663
@YangJonghun Any fix for this error? |
@Pavi-t2s |
same issue on 71.8 |
I encountered a similar issue on RN v0.73.0 after upgrading from v0.70.12. Our RCA was on v0.70.12 if we returned undefined value from keyExtractor for any child FlatList being rendered as item then when the items in Parent FlatList get destroyed/removed/cleaned nothing would break and FlatList will somehow manage it internally. But doing same on v0.73.0 would crash the app with So this was causing the crash on v0.73.0
where id is undefined for a child FlatList and changing this to below fixed it
Also got those missing IDs added. |
Description
Trying to remove non-present child list
error occurred with specific case(please check below reproduce or example)
Version
0.71.0
Output of
npx react-native info
It doesn't related with dev environment. it is JS issue
this problem occurred within
react-native/Libraries/Lists/ChildListCollection.js
Steps to reproduce
Snack, code example, screenshot, or link to a repository
just render below component
The text was updated successfully, but these errors were encountered: