microsoft / fluentui-react-native

A react-native component library that implements the Fluent Design System.
https://developer.microsoft.com/fluentui
MIT License
1.25k stars 161 forks source link

Cache results of theme module getConstants #3674

Closed acoates-ms closed 2 months ago

acoates-ms commented 2 months ago

Platforms Impacted

Description of changes

When running react-native in bridgeless mode, the results of getConstants are no longer cached by the JS side. This causes 100s of calls into the theming modules getConstants method, which then has to load and marshall the whole theming data from native to JS.

With this change we'll cache the result of getConstants to avoid the performance cost of calling it multiple times.