@@ -3,7 +3,7 @@ import { addStabilizationToFilter } from '@exogee/graphweaver-apollo-client';
3
3
import { Row , RowSelectionState } from '@tanstack/react-table' ;
4
4
import { useMemo , useState } from 'react' ;
5
5
import toast from 'react-hot-toast' ;
6
- import { Outlet , useNavigate , useParams , useSearchParams } from 'react-router-dom ' ;
6
+ import { useLocation , useParams , useSearchParams } from 'wouter ' ;
7
7
8
8
import { Button } from '../button' ;
9
9
import { generateDeleteManyEntitiesMutation } from '../detail-panel/graphql' ;
@@ -27,11 +27,11 @@ import { QueryResponse, queryForEntityPage } from './graphql';
27
27
import { ExportModal } from '../export-modal' ;
28
28
import styles from './styles.module.css' ;
29
29
30
- export const EntityList = < TData extends object > ( ) => {
30
+ export const EntityList = < TData extends object > ( { children } : { children : React . ReactNode } ) => {
31
31
const { entity : entityName , id } = useParams ( ) ;
32
32
if ( ! entityName ) throw new Error ( 'There should always be an entity at this point.' ) ;
33
33
34
- const navigate = useNavigate ( ) ;
34
+ const [ , setLocation ] = useLocation ( ) ;
35
35
const { entityByName, entityByType } = useSchema ( ) ;
36
36
const [ search ] = useSearchParams ( ) ;
37
37
const { sort : sorting , filters } = decodeSearchParams ( search ) ;
@@ -47,7 +47,7 @@ export const EntityList = <TData extends object>() => {
47
47
defaultFilter,
48
48
fieldForDetailPanelNavigationId,
49
49
excludeFromTracing,
50
- supportsPseudoCursorPagination
50
+ supportsPseudoCursorPagination,
51
51
} = entity ;
52
52
const columns = useMemo (
53
53
( ) => convertEntityToColumns ( entity , entityByType ) ,
@@ -84,11 +84,11 @@ export const EntityList = <TData extends object>() => {
84
84
}
85
85
86
86
const handleRowClick = < T extends object > ( row : Row < T > ) => {
87
- navigate ( `${ row . original [ fieldForDetailPanelNavigationId as keyof T ] } ` ) ;
87
+ setLocation ( `${ row . original [ fieldForDetailPanelNavigationId as keyof T ] } ` ) ;
88
88
} ;
89
89
90
90
const handleSortClick = ( newSort : SortEntity ) => {
91
- navigate (
91
+ setLocation (
92
92
routeFor ( {
93
93
entity,
94
94
filters,
@@ -103,15 +103,17 @@ export const EntityList = <TData extends object>() => {
103
103
const offset = supportsPseudoCursorPagination ? 0 : nextPage * PAGE_SIZE ;
104
104
105
105
const filterVar = variables . filter ?? { } ;
106
- const filter = supportsPseudoCursorPagination ? addStabilizationToFilter ( filterVar , sort , data ?. result ?. [ data . result . length - 1 ] ) : filterVar ;
106
+ const filter = supportsPseudoCursorPagination
107
+ ? addStabilizationToFilter ( filterVar , sort , data ?. result ?. [ data . result . length - 1 ] )
108
+ : filterVar ;
107
109
fetchMore ( {
108
110
variables : {
109
111
...variables ,
110
112
pagination : {
111
113
...variables . pagination ,
112
- offset
114
+ offset,
113
115
} ,
114
- filter
116
+ filter,
115
117
} ,
116
118
} ) ;
117
119
} ;
@@ -207,7 +209,7 @@ export const EntityList = <TData extends object>() => {
207
209
{ showExportModal && (
208
210
< ExportModal closeModal = { ( ) => setShowExportModal ( false ) } sort = { sort } filters = { filters } />
209
211
) }
210
- < Outlet />
212
+ { children }
211
213
</ div >
212
214
) ;
213
215
} ;
0 commit comments