From d7524d05f23d3844aa5ac27b51522bce3dda14e5 Mon Sep 17 00:00:00 2001 From: Alban Bailly Date: Mon, 9 Dec 2024 21:13:08 -0500 Subject: [PATCH] feedback @coliu-akamai @hkhalil-akamai --- .../manager/src/hooks/useOrderV2.test.tsx | 2 +- packages/manager/src/routes/volumes/index.ts | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/manager/src/hooks/useOrderV2.test.tsx b/packages/manager/src/hooks/useOrderV2.test.tsx index 37c4f632976..6e06c77020e 100644 --- a/packages/manager/src/hooks/useOrderV2.test.tsx +++ b/packages/manager/src/hooks/useOrderV2.test.tsx @@ -106,7 +106,7 @@ describe('useOrderV2', () => { }); }); - it.only('should update URL and preferences when handleOrderChange is called', async () => { + it('should update URL and preferences when handleOrderChange is called', async () => { const mutatePreferencesMock = vi.fn(); server.use( http.put('*/profile/preferences', async ({ request }) => { diff --git a/packages/manager/src/routes/volumes/index.ts b/packages/manager/src/routes/volumes/index.ts index 296f548d33a..87db6e3ce86 100644 --- a/packages/manager/src/routes/volumes/index.ts +++ b/packages/manager/src/routes/volumes/index.ts @@ -45,6 +45,11 @@ const volumesCreateRoute = createRoute({ import('./volumesLazyRoutes').then((m) => m.volumeCreateLazyRoute) ); +type VolumeActionRouteParams

= { + action: VolumeAction; + volumeId: P; +}; + const volumeActionRoute = createRoute({ beforeLoad: async ({ params }) => { if (!(params.action in volumeAction)) { @@ -55,16 +60,16 @@ const volumeActionRoute = createRoute({ } }, getParentRoute: () => volumesRoute, - parseParams: ({ - action, - volumeId, - }: { - action: VolumeAction; - volumeId: string; - }) => ({ - action, - volumeId: Number(volumeId), - }), + params: { + parse: ({ action, volumeId }: VolumeActionRouteParams) => ({ + action, + volumeId: Number(volumeId), + }), + stringify: ({ action, volumeId }: VolumeActionRouteParams) => ({ + action, + volumeId: String(volumeId), + }), + }, path: '$volumeId/$action', validateSearch: (search: VolumesSearchParams) => search, }).lazy(() =>