refactor(many): remove exact from test pages

This commit is contained in:
Maria Hutt
2025-06-13 12:05:18 -07:00
parent c45c0f9bfa
commit 12c49f5c51
14 changed files with 42 additions and 53 deletions

View File

@@ -46,7 +46,7 @@ const App: React.FC = () => {
<IonApp>
<IonReactRouter>
<IonRouterOutlet>
<Route path="/" element={<Main />} exact />
<Route path="/" element={<Main />} />
<Route path="/routing" element={<Routing />} />
<Route path="/dynamic-routes" element={<DynamicRoutes />} />
<Route path="/multiple-tabs" element={<MultipleTabs />} />

View File

@@ -16,13 +16,12 @@ const DynamicRoutes: React.FC = () => {
key="sldjflsdj"
path="/dynamic-routes/home"
render={() => <Home update={addRoute} />}
exact={true}
/>,
]);
const addRoute = () => {
const newRoute = (
<Route key="lsdjldj" path="/dynamic-routes/newRoute" element={<NewRoute />} exact={true} />
<Route key="lsdjldj" path="/dynamic-routes/newRoute" element={<NewRoute />} />
);
setRoutes([...routes, newRoute]);
};
@@ -30,8 +29,8 @@ const DynamicRoutes: React.FC = () => {
return (
<IonRouterOutlet>
{routes}
{/* <Route exact path="/home" render={() => <Home update={addRoute} />} /> */}
<Route exact path="/dynamic-routes" render={() => <Navigate to="/dynamic-routes/home" replace />} />
{/* <Route path="/home" render={() => <Home update={addRoute} />} /> */}
<Route path="/dynamic-routes" render={() => <Navigate to="/dynamic-routes/home" replace />} />
<Route render={() => <Failed />} />
</IonRouterOutlet>
);

View File

@@ -40,12 +40,11 @@ const DynamicTabs: React.FC = () => {
<IonReactRouter>
<IonTabs>
<IonRouterOutlet>
<Route path="/dynamic-tabs/tab1" render={renderFirstTab} exact={true} />
<Route path="/dynamic-tabs/tab1" render={renderFirstTab} />
{render2ndTabRoute()}
<Route
path="/dynamic-tabs/"
render={() => <Navigate to="/dynamic-tabs/tab1" replace />}
exact={true}
/>
<Route render={() => <Navigate to="/dynamic-tabs/tab1" replace />} />
</IonRouterOutlet>

View File

@@ -26,23 +26,20 @@ const MultipleTabs: React.FC = () => {
<Menu />
<IonRouterOutlet id="main">
<Route
path="/multiple-tabs/tab1"
path="/multiple-tabs/tab1/*"
render={() => {
return <Tab1 />;
}}
exact={false}
/>
<Route
path="/multiple-tabs/tab2"
path="/multiple-tabs/tab2/*"
render={() => {
return <Tab2 />;
}}
exact={false}
/>
<Route
path="/multiple-tabs"
render={() => <Navigate to="/multiple-tabs/tab1" replace />}
exact={true}
/>
</IonRouterOutlet>
</IonSplitPane>
@@ -69,11 +66,10 @@ const Tab1: React.FC = () => {
<Route
path="/multiple-tabs/tab1"
render={() => <Navigate to="/multiple-tabs/tab1/pagea" replace />}
exact={true}
/>
{/* <Navigate path="/multiple-tabs/event" to="/multiple-tabs/tab1/pagea" exact={true} replace /> */}
<Route path="/multiple-tabs/tab1/pagea" render={() => <Page name="PageA" />} exact={true} />
<Route path="/multiple-tabs/tab1/pageb" render={() => <Page name="PageB" />} exact={true} />
{/* <Navigate path="/multiple-tabs/event" to="/multiple-tabs/tab1/pagea" replace /> */}
<Route path="/multiple-tabs/tab1/pagea" render={() => <Page name="PageA" />} />
<Route path="/multiple-tabs/tab1/pageb" render={() => <Page name="PageB" />} />
</IonRouterOutlet>
</IonTabs>
);
@@ -96,11 +92,10 @@ const Tab2: React.FC = () => {
<Route
path="/multiple-tabs/tab2"
render={() => <Navigate to="/multiple-tabs/tab2/pagec" replace />}
exact={true}
/>
{/* <Navigate path="/multiple-tabs/tab2" to="/multiple-tabs/tab2/pagec" exact={true} replace /> */}
<Route path="/multiple-tabs/tab2/pagec" render={() => <Page name="PageC" />} exact={true} />
<Route path="/multiple-tabs/tab2/paged" render={() => <Page name="PageD" />} exact={true} />
{/* <Navigate path="/multiple-tabs/tab2" to="/multiple-tabs/tab2/pagec" replace /> */}
<Route path="/multiple-tabs/tab2/pagec" render={() => <Page name="PageC" />} />
<Route path="/multiple-tabs/tab2/paged" render={() => <Page name="PageD" />} />
</IonRouterOutlet>
</IonTabs>
);

View File

@@ -48,10 +48,9 @@ const SecondPage: React.FC = () => {
<IonRouterOutlet ionPage>
<Route
path="/nested-outlet/secondpage"
exact={true}
render={() => <Navigate to="/nested-outlet/secondpage/page" replace />}
/>
<Route path="/nested-outlet/secondpage/page" element={<Page />} exact={true} />
<Route path="/nested-outlet/secondpage/page" element={<Page />} />
</IonRouterOutlet>
);
};
@@ -81,7 +80,7 @@ const FirstPage: React.FC = () => {
const NestedOutlet: React.FC = () => (
<IonRouterOutlet>
<Route path="/nested-outlet" element={<FirstPage />} exact={true} />
<Route path="/nested-outlet" element={<FirstPage />} />
<Route path="/nested-outlet/secondpage" element={<SecondPage />} />
</IonRouterOutlet>
);

View File

@@ -17,7 +17,7 @@ import {
const ListPage: React.FC<RouteComponentProps> = ({ match }) => {
return (
<IonRouterOutlet ionPage id="listpage">
<Route exact path="/nested-outlet2/list" element={<List />} />
<Route path="/nested-outlet2/list" element={<List />} />
<Route path={`${match.url}/:id`} element={<Item />} />
</IonRouterOutlet>
);
@@ -70,7 +70,7 @@ const Item: React.FC<RouteComponentProps<{ id: string }>> = ({ match }) => {
const HomePage: React.FC<RouteComponentProps> = ({ match }) => {
return (
<IonRouterOutlet ionPage id="homepage">
<Route exact path="/nested-outlet2/home" element={<Home />} />
<Route path="/nested-outlet2/home" element={<Home />} />
<Route path="/nested-outlet2/home/welcome" element={<Welcome />} />
</IonRouterOutlet>
);
@@ -127,7 +127,6 @@ const NestedOutlet2: React.FC = () => (
<Route
path="/nested-outlet2"
render={() => <Navigate to="/nested-outlet2/home" replace />}
exact={true}
/>
</IonRouterOutlet>
);

View File

@@ -14,9 +14,9 @@ interface RefsProps {}
const Refs: React.FC = () => {
return (
<IonRouterOutlet>
{/* <Route exact path="/home" render={() => <Home update={addRoute} />} /> */}
<Route exact path="/refs" element={<RefsFC />} />
<Route exact path="/refs/class" element={<RefsClass/ >} />
{/* <Route path="/home" render={() => <Home update={addRoute} />} /> */}
<Route path="/refs" element={<RefsFC />} />
<Route path="/refs/class" element={<RefsClass/ >} />
</IonRouterOutlet>
);
};

View File

@@ -17,10 +17,10 @@ interface TopPageProps {}
const ReplaceAction: React.FC<TopPageProps> = () => {
return (
<IonRouterOutlet>
<Route path="/replace-action/page1" element={<Page1 />} exact />
<Route path="/replace-action/page2" element={<Page2 />} exact />
<Route path="/replace-action/page3" element={<Page3 />} exact />
<Route exact path="/replace-action" render={() => <Navigate to="/replace-action/page1" replace />} />
<Route path="/replace-action/page1" element={<Page1 />} />
<Route path="/replace-action/page2" element={<Page2 />} />
<Route path="/replace-action/page3" element={<Page3 />} />
<Route path="/replace-action" render={() => <Navigate to="/replace-action/page1" replace />} />
</IonRouterOutlet>
);
};

View File

@@ -22,7 +22,7 @@ const Routing: React.FC<RoutingProps> = () => {
<IonRouterOutlet id="main">
<Route path="/routing/tabs" render={() => <Tabs />} />
{/* <Route path="/routing/tabs" element={<Tabs />} /> */}
<Route path="/routing/" render={() => <Navigate to="/routing/tabs" />} exact replace />
<Route path="/routing/" render={() => <Navigate to="/routing/tabs" />} replace />
<Route path="/routing/favorites" element={<Favorites />} />
{/* <Route path="/routing/favorites" render={() => {
return (

View File

@@ -14,23 +14,21 @@ const Tabs: React.FC<TabsProps> = () => {
return (
<IonTabs>
<IonRouterOutlet id="tabs">
<Route path="/routing/tabs/home" element={<Tab1 />} exact />
<Route path="/routing/tabs/home/details/:id" element={<Details />} exact={true} />
<Route path="/routing/tabs/home" element={<Tab1 />} />
<Route path="/routing/tabs/home/details/:id" element={<Details />} />
{/* <Route path="/routing/tabs/home/details/:id" render={(props) => {
return <Details />
}} exact={true} /> */}
<Route path="/routing/tabs/settings" element={<Tab2 />} exact={true} />
<Route path="/routing/tabs/settings/details/:id" element={<SettingsDetails />} exact={true} />
}} /> */}
<Route path="/routing/tabs/settings" element={<Tab2 />} />
<Route path="/routing/tabs/settings/details/:id" element={<SettingsDetails />} />
<Route path="/routing/tabs/tab3" element={<Tab3 />} />
<Route
path="/routing/tabs"
render={() => <Navigate to="/routing/tabs/home" replace />}
exact={true}
/>
<Route
path="/routing/tabs/redirect"
render={() => <Navigate to="/routing/tabs/settings" replace />}
exact={true}
/>
{/* <Route path="/routing/tabs" render={() => <Route render={() => <Navigate to="/tabs/home" replace />} />} /> */}
</IonRouterOutlet>

View File

@@ -17,7 +17,7 @@ interface SwipeToGoBackProps {}
export const SwipeToGoBack: React.FC<SwipeToGoBackProps> = () => {
return (
<IonRouterOutlet id="swipe-to-go-back">
<Route path="/swipe-to-go-back" element={<Main />} exact />
<Route path="/swipe-to-go-back" element={<Main />} />
<Route path="/swipe-to-go-back/details" element={<Details />} />
</IonRouterOutlet>
);

View File

@@ -25,9 +25,9 @@ const TabsContext: React.FC<TabsContextProps> = () => {
return (
<IonTabs>
<IonRouterOutlet id="tabs">
<Route path="/tab-context/tab1" element={<Tab1 />} exact />
<Route path="/tab-context/tab2" element={<Tab2 />} exact />
<Navigate from="/tab-context" to="/tab-context/tab1" exact replace />
<Route path="/tab-context/tab1" element={<Tab1 />} />
<Route path="/tab-context/tab2" element={<Tab2 />} />
<Navigate from="/tab-context" to="/tab-context/tab1" replace />
</IonRouterOutlet>
<IonTabBar slot="bottom">
<IonTabButton tab="tab1" href="/tab-context/tab1" routerOptions={{ unmount: true }}>

View File

@@ -24,11 +24,11 @@ const Tabs: React.FC<TabsProps> = () => {
return (
<IonTabs data-pageid="tabs">
<IonRouterOutlet id="tabs">
<Route path="/tabs/tab1" element={<Tab1 />} exact />
<Route path="/tabs/tab2" element={<Tab2 />} exact />
<Route path="/tabs/tab1/child" element={<Tab1Child1 />} exact />
<Route path="/tabs/tab1/child2" element={<Tab1Child2 />} exact />
<Navigate from="/tabs" to="/tabs/tab1" exact replace />
<Route path="/tabs/tab1" element={<Tab1 />} />
<Route path="/tabs/tab2" element={<Tab2 />} />
<Route path="/tabs/tab1/child" element={<Tab1Child1 />} />
<Route path="/tabs/tab1/child2" element={<Tab1Child2 />} />
<Navigate from="/tabs" to="/tabs/tab1" replace />
</IonRouterOutlet>
<IonTabBar slot="bottom">
<IonTabButton tab="tab1" href="/tabs/tab1">

View File

@@ -23,9 +23,9 @@ const TabsSecondary: React.FC<TabsSecondaryProps> = () => {
return (
<IonTabs>
<IonRouterOutlet id="tabs-secondary">
<Route path="/tabs-secondary/tab1" element={<Tab1 />} exact />
<Route path="/tabs-secondary/tab2" element={<Tab2 />} exact />
<Navigate from="/tabs-secondary" to="/tabs-secondary/tab1" exact replace />
<Route path="/tabs-secondary/tab1" element={<Tab1 />} />
<Route path="/tabs-secondary/tab2" element={<Tab2 />} />
<Navigate from="/tabs-secondary" to="/tabs-secondary/tab1" replace />
</IonRouterOutlet>
<IonTabBar slot="bottom">
<IonTabButton tab="tab1-secondary" href="/tabs-secondary/tab1">