66 useAbstractQuery ,
77 AbstractQuery ,
88 AbstractQueryOptions ,
9- RouterSSR ,
9+ Router ,
1010} from '../engine/query'
1111import {
1212 PaginationQuery ,
@@ -20,7 +20,7 @@ const DEFAULT_NEXT_ROUTER_OPTIONS: RouterWithHistoryOptions = {
2020
2121const useNextRouter = (
2222 options : undefined | Partial < RouterWithHistoryOptions > ,
23- ) : RouterSSR => {
23+ ) : Router => {
2424 const nextRouter = useRouter ( )
2525
2626 const mergedOptions = useMemo (
@@ -55,7 +55,6 @@ const useNextRouter = (
5555 } )
5656 }
5757 } ,
58- isQueryReady : nextRouter . isReady ,
5958 }
6059}
6160
@@ -68,8 +67,7 @@ export const useQuery = <
6867 options ?: Partial < AbstractQueryOptions & RouterWithHistoryOptions > ,
6968) => {
7069 const router = useNextRouter ( options )
71- const result = useAbstractQuery ( router , parseQuery , defaultQuery , options )
72- return { ...result , isQueryReady : router . isQueryReady }
70+ return useAbstractQuery ( router , parseQuery , defaultQuery , options )
7371}
7472
7573export const useQueryAndPagination = <
@@ -82,36 +80,27 @@ export const useQueryAndPagination = <
8280 options ?: Partial < AbstractQueryOptions & RouterWithHistoryOptions > ,
8381) => {
8482 const router = useNextRouter ( options )
85- const result = useAbstractQueryAndPagination (
83+ return useAbstractQueryAndPagination (
8684 router ,
8785 parseQuery ,
8886 defaultQuery ,
8987 defaultPagination ,
9088 options ,
9189 )
92- return { ...result , isQueryReady : router . isQueryReady }
9390}
9491
9592export const usePagination = (
9693 defaultPagination ?: Partial < PaginationQuery > ,
9794 options ?: Partial < AbstractQueryOptions & RouterWithHistoryOptions > ,
9895) => {
99- const {
100- page,
101- size,
102- setPage,
103- setSize,
104- setPagination,
105- resetPagination,
106- isQueryReady,
107- } = useQueryAndPagination ( ( ) => ( { } ) , { } , defaultPagination , options )
96+ const { page, size, setPage, setSize, setPagination, resetPagination } =
97+ useQueryAndPagination ( ( ) => ( { } ) , { } , defaultPagination , options )
10898 return {
10999 page,
110100 size,
111101 setPage,
112102 setSize,
113103 setPagination,
114104 resetPagination,
115- isQueryReady,
116105 }
117106}
0 commit comments