@ionic/react 9.0.8-nightly.20261008 → 9.0.8-nightly.20261009

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3416,8 +3416,25 @@ class NavManager extends React.PureComponent {
3416
3416
  getStackManager() {
3417
3417
  return this.props.stackManager;
3418
3418
  }
3419
+ /**
3420
+ * Cached on `routeInfo` because `state` never changes after the constructor.
3421
+ * A new object on every render would re-render every consumer, including
3422
+ * hidden pages.
3423
+ */
3424
+ contextValues;
3425
+ getContextValues() {
3426
+ const { routeInfo } = this.props;
3427
+ if (this.contextValues?.navContext.routeInfo !== routeInfo) {
3428
+ this.contextValues = {
3429
+ navContext: { ...this.state, routeInfo },
3430
+ ionRouterContext: { ...this.ionRouterContextValue, routeInfo },
3431
+ };
3432
+ }
3433
+ return this.contextValues;
3434
+ }
3419
3435
  render() {
3420
- return (jsx(NavContext.Provider, { value: { ...this.state, routeInfo: this.props.routeInfo }, children: jsx(IonRouterContext.Provider, { value: { ...this.ionRouterContextValue, routeInfo: this.props.routeInfo }, children: this.props.children }) }));
3436
+ const { navContext, ionRouterContext } = this.getContextValues();
3437
+ return (jsx(NavContext.Provider, { value: navContext, children: jsx(IonRouterContext.Provider, { value: ionRouterContext, children: this.props.children }) }));
3421
3438
  }
3422
3439
  }
3423
3440