react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Adds quirk setting to skip removing children in unmount

Open rozele opened this issue 3 years ago • 0 comments

Description

Type of Change

Erase all that don't apply.

  • New feature (non-breaking change which adds functionality)

Why

The removeChildren option in DropView can be used to conditionally recurse the Yoga and native view tree to clean up each node. This would be required if we wanted to pool or otherwise recycle Yoga nodes or XAML views, but we do not do this today. For large UI transitions involving hundreds or thousands of nodes, this recursion can be quite costly so we should evaluate whether it's truly needed.

What

While we could just explicitly set this to false, my concern is that this could create potential memory leaks, and its better to default to the pre-existing behavior and opt-in for experimentation. Thus the behavior is hidden behind a QuirkSetting.

In addition to adding the QuirkSetting, this change also wires up a change event on QuirkSettings that can be subscribed to in PaperUIManagerModule so we can get fresh quirk settings when they change. While quirk settings are generally set before starting the ReactInstance, if someone wanted to A/B test this functionality and hide it behind a feature flag, it's possible that they might want to change the QuirkSetting at runtime.

Testing

Added a new QuirkSetting menu to Playground-win32, and tested out checking the box and unchecking the box at runtime. I confirmed that the QuirkSettingsChanged callback fires as expected, the values are refreshed and the PaperUIManagerModule uses the correct value when changed.

Microsoft Reviewers: Open in CodeFlow

rozele avatar Sep 15 '22 14:09 rozele