@ionic/react-router 9.0.11-dev.11794253811.110d3f94 → 9.0.11-dev.11794308212.1f37a3b7

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
@@ -1,6 +1,6 @@
1
1
  import React, { useRef, useState, useEffect, useCallback } from 'react';
2
2
  import { Route, matchPath as matchPath$1, Routes, Navigate, UNSAFE_RouteContext, matchRoutes, useLocation, useNavigate, BrowserRouter, useNavigationType, HashRouter } from 'react-router-dom';
3
- import { IonRoute, ViewStacks, generateId, ViewLifeCycleManager, StackContext, createDebugLogger, RouteManagerContext, getConfig, LocationHistory, NavManager } from '@ionic/react';
3
+ import { IonRoute, ViewStacks, generateId, ViewLifeCycleManager, createDebugLogger, StackContext, RouteManagerContext, getConfig, LocationHistory, NavManager } from '@ionic/react';
4
4
  import { LIFECYCLE_WILL_LEAVE, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_DID_ENTER } from '@ionic/core/components';
5
5
  import { MemoryRouter, useLocation as useLocation$1, useNavigationType as useNavigationType$1 } from 'react-router';
6
6
 
@@ -752,19 +752,6 @@ const ViewRouteContextProvider = ({ value, hold, children }) => {
752
752
  }
753
753
  return React.createElement(UNSAFE_RouteContext.Provider, { value: heldValue }, children);
754
754
  };
755
- /**
756
- * Passes the view that rendered a page to `registerIonPage`. A page that mounts
757
- * during a navigation registers with the previous pathname, so the path lookup
758
- * alone can pick the wrong view.
759
- */
760
- const ViewStackContextProvider = ({ viewItem, children }) => {
761
- const parent = React.useContext(StackContext);
762
- const value = React.useMemo(() => ({
763
- ...parent,
764
- registerIonPage: (page, routeInfo) => parent.registerIonPage(page, routeInfo, viewItem),
765
- }), [parent, viewItem]);
766
- return React.createElement(StackContext.Provider, { value: value }, children);
767
- };
768
755
  class ReactRouterViewStack extends ViewStacks {
769
756
  /**
770
757
  * Stores the computed parent path for each outlet.
@@ -1066,8 +1053,7 @@ class ReactRouterViewStack extends ViewStacks {
1066
1053
  ? { ...parentContext, matches: contextMatches }
1067
1054
  : { outlet: null, matches: contextMatches, isDataRoute: false };
1068
1055
  return (React.createElement(ViewLifeCycleManager, { key: `view-${viewItem.id}`, mount: viewItem.mount, removeView: () => this.remove(viewItem) },
1069
- React.createElement(ViewRouteContextProvider, { value: routeContextValue, hold: holdRouteContext },
1070
- React.createElement(ViewStackContextProvider, { viewItem: viewItem }, componentElement))));
1056
+ React.createElement(ViewRouteContextProvider, { value: routeContextValue, hold: holdRouteContext }, componentElement)));
1071
1057
  }));
1072
1058
  };
1073
1059
  /**
@@ -2501,9 +2487,8 @@ class StackManager extends React.PureComponent {
2501
2487
  *
2502
2488
  * @param page The element of the rendered `<IonPage>`.
2503
2489
  * @param routeInfo The route information that associates with `<IonPage>`.
2504
- * @param ownerViewItem The view item that rendered `<IonPage>`, if known.
2505
2490
  */
2506
- registerIonPage(page, routeInfo, ownerViewItem) {
2491
+ registerIonPage(page, routeInfo) {
2507
2492
  /**
2508
2493
  * DO NOT remove ion-page-invisible here.
2509
2494
  *
@@ -2522,12 +2507,7 @@ class StackManager extends React.PureComponent {
2522
2507
  this.ionPageWaitTimeout = undefined;
2523
2508
  }
2524
2509
  this.pendingPageTransition = false;
2525
- const pathView = this.context.findViewItemByRouteInfo(routeInfo, this.id);
2526
- /**
2527
- * The lookup can use a stale pathname (see `ViewStackContextProvider`), so
2528
- * prefer the view that rendered the page when the two disagree.
2529
- */
2530
- const foundView = pathView && ownerViewItem?.outletId === this.id && pathView !== ownerViewItem ? ownerViewItem : pathView;
2510
+ const foundView = this.context.findViewItemByRouteInfo(routeInfo, this.id);
2531
2511
  if (foundView) {
2532
2512
  const oldPageElement = foundView.ionPageElement;
2533
2513
  /**