Skip to content
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

Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent #35875

Closed
wants to merge 1 commit into from

Commits on Jan 18, 2023

  1. Fix invariant violation when nesting VirtualizedList inside ListEmpty…

    …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
    NickGerleman authored and facebook-github-bot committed Jan 18, 2023
    Configuration menu
    Copy the full SHA
    be8524b View commit details
    Browse the repository at this point in the history