From df29cafaf8d6fc693c82171c073553141beeb1b8 Mon Sep 17 00:00:00 2001 From: Joshua Kitenge Date: Wed, 8 Jan 2025 16:03:33 +0000 Subject: [PATCH] Address review comments #1211 - manufacturer loader in the correct location - Add scroll restoration react router - add dev tool for react query --- src/App.tsx | 21 +++-- .../adminCardView.component.test.tsx.snap | 85 ------------------- src/admin/adminCardView.component.tsx | 10 +-- src/admin/adminLayout.component.tsx | 9 +- .../units.component.test.tsx.snap | 52 ------------ src/admin/units/units.component.test.tsx | 4 + 6 files changed, 26 insertions(+), 155 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index daf992419..7d7574d77 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,17 +1,18 @@ +import { LocalizationProvider } from '@mui/x-date-pickers'; +import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'; +import type { Router } from '@remix-run/router'; import { QueryCache, QueryClient, QueryClientProvider, } from '@tanstack/react-query'; -import React from 'react'; -// import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; -import { LocalizationProvider } from '@mui/x-date-pickers'; -import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'; -import type { Router } from '@remix-run/router'; +import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { AxiosError } from 'axios'; import { enGB } from 'date-fns/locale/en-GB'; +import React from 'react'; import { RouterProvider, + ScrollRestoration, createBrowserRouter, type RouteObject, } from 'react-router-dom'; @@ -119,11 +120,14 @@ const routeObject: RouteObject[] = [ { path: paths.manufacturers, Component: ManufacturerLayout, - loader: manufacturerLayoutLoader(queryClient), ErrorBoundary: ManufacturerLayoutErrorComponent, children: [ { index: true, Component: ManufacturerTable }, - { path: paths.manufacturer, Component: ManufacturerLandingPage }, + { + path: paths.manufacturer, + Component: ManufacturerLandingPage, + loader: manufacturerLayoutLoader(queryClient), + }, { path: '*', Component: ManufacturerErrorComponent, @@ -188,7 +192,8 @@ export function Layout() { } > - {/* */} + + diff --git a/src/admin/__snapshots__/adminCardView.component.test.tsx.snap b/src/admin/__snapshots__/adminCardView.component.test.tsx.snap index b5d7b0f3e..56b271aad 100644 --- a/src/admin/__snapshots__/adminCardView.component.test.tsx.snap +++ b/src/admin/__snapshots__/adminCardView.component.test.tsx.snap @@ -84,88 +84,3 @@ exports[`AdminCardView > renders admin card view correctly 1`] = ` `; - -exports[`AdminPage > renders admin page correctly 1`] = ` - - - -`; diff --git a/src/admin/adminCardView.component.tsx b/src/admin/adminCardView.component.tsx index f9d3ba55a..660b818a4 100644 --- a/src/admin/adminCardView.component.tsx +++ b/src/admin/adminCardView.component.tsx @@ -9,7 +9,7 @@ function AdminCardView() {