Skip to content

Commit

Permalink
implemented v7_relativeSplatPath
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhaeger committed Dec 10, 2024
1 parent 871592b commit 8d5b1d4
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 55 deletions.
64 changes: 35 additions & 29 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,50 @@ export const App = () => (
element={<FormFirstPage />}
/>
</Route>
<Route
path='/instance-selection/*'
element={<InstanceSelectionWrapper />}
/>

<Route
path='/party-selection/*'
element={<PartySelection />}
/>

<Route
path='/instance/:partyId/:instanceGuid/*'
element={
<InstanceProvider>
<Outlet />
</InstanceProvider>
}
>
<Route path='/instance-selection'>
<Route
path=':taskId/*'
element={<ProcessWrapper />}
path='*'
element={<InstanceSelectionWrapper />}
/>
</Route>

<Route path='/party-selection'>
<Route
path={TaskKeys.ProcessEnd}
element={<DefaultReceipt />}
path='*'
element={<PartySelection />}
/>
<Route path={TaskKeys.CustomReceipt}>
</Route>

<Route path='/instance/:partyId/:instanceGuid'>
<Route
path='*'
element={
<InstanceProvider>
<Outlet />
</InstanceProvider>
}
>
<Route
path='*'
element={<CustomReceipt />}
path=':taskId/*'
element={<ProcessWrapper />}
/>
<Route
path={TaskKeys.ProcessEnd}
element={<DefaultReceipt />}
/>
<Route path={TaskKeys.CustomReceipt}>
<Route
path='*'
element={<CustomReceipt />}
/>
</Route>
<Route
index
element={<NavigateToStartUrl />}
/>
</Route>
<Route
index
element={<NavigateToStartUrl />}
/>
</Route>

{/**
* Redirects from legacy URLs to new URLs
*/}
Expand Down
18 changes: 10 additions & 8 deletions src/components/wrappers/ProcessWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,16 @@ export const ProcessWrapper = () => {
return (
<FormProvider>
<Routes>
<Route
path=':pageKey/:componentId/*'
element={
<PresentationComponent type={ProcessTaskType.Data}>
<ComponentRouting />
</PresentationComponent>
}
/>
<Route path=':pageKey/:componentId'>
<Route
path='*'
element={
<PresentationComponent type={ProcessTaskType.Data}>
<ComponentRouting />
</PresentationComponent>
}
/>
</Route>
<Route
path='*'
element={
Expand Down
18 changes: 10 additions & 8 deletions src/features/receipt/ReceiptContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ export function CustomReceipt() {
return (
<FormProvider>
<Routes>
<Route
path=':pageKey/:componentId/*'
element={
<PresentationComponent type={ProcessTaskType.Archived}>
<ComponentRouting />
</PresentationComponent>
}
/>
<Route path=':pageKey/:componentId'>
<Route
path='*'
element={
<PresentationComponent type={ProcessTaskType.Archived}>
<ComponentRouting />
</PresentationComponent>
}
/>
</Route>
<Route
path='*'
element={
Expand Down
27 changes: 17 additions & 10 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,25 @@ import 'react-toastify/dist/ReactToastify.css';
import 'src/index.css';
import '@digdir/designsystemet-theme/brand/altinn/tokens.css';

const router = createHashRouter([
const router = createHashRouter(
[
{
path: '*',
element: (
<AppRoutingProvider>
<ErrorBoundary>
<Root />
</ErrorBoundary>
</AppRoutingProvider>
),
},
],
{
path: '*',
element: (
<AppRoutingProvider>
<ErrorBoundary>
<Root />
</ErrorBoundary>
</AppRoutingProvider>
),
future: {
v7_relativeSplatPath: true,
},
},
]);
);

document.addEventListener('DOMContentLoaded', () => {
propagateTraceWhenPdf();
Expand Down

0 comments on commit 8d5b1d4

Please sign in to comment.