Skip to content

[Bug]: List virtualization won't work in Strict mode #29880

@mhverbakel

Description

@mhverbakel

Library

React / v8 (@fluentui/react)

System Info

System:                                                      
    OS: Windows 10 10.0.19045                                  
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 7.18 GB / 31.69 GB                                 
  Browsers:                                                    
    Edge: Spartan (44.19041.3570.0), Chromium (119.0.2151.44)  
    Internet Explorer: 11.0.19041.3570

Are you reporting Accessibility issue?

no

Reproduction

https://codepen.io/m-verbakel-eshgro/pen/WNPMaGN

Bug Description

Actual Behavior

When rendering a list with virtualization enabled in strict mode, the next page is not rendered.

Expected Behavior

Rendering a list with virtualization enabled in strict mode behaves the same as a list with virtualization enabled without strict mode.

Cause

Strict mode renders the component twice. To do this, the component is unmounted and then remounted. In List.componentWillUnmount, a dispose is called on the EventGroup. However, since the EventGroup is only instantiated in the constructor, the disposed EventGroup is reused when componentDidMount is called again. Hence, the event listeners for scrolling are added, but they immediately return because their group is disposed.

This seems to be related to #28230 (comment).

Logs

No response

Requested priority

Normal

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions