1
1
import { parseWithZod } from "@conform-to/zod" ;
2
2
import { Anchor , Card , Container , Divider , Group , Stack } from "@mantine/core" ;
3
- import { data , Link , redirect , useNavigation } from "react-router" ;
3
+ import { data , Link , redirect } from "react-router" ;
4
4
import { getQuery , withQuery } from "ufo" ;
5
5
6
6
import Fa6SolidMagnifyingGlass from "~icons/fa6-solid/magnifying-glass" ;
@@ -14,6 +14,7 @@ import {
14
14
searchApiV1DataSearchGet ,
15
15
} from "../generated/api/client" ;
16
16
import type { SearchedNote , Topic } from "../generated/api/schemas" ;
17
+ import { useNetworkBusy } from "../hooks/useNetworkBusy" ;
17
18
import type { Route } from "./+types/_index" ;
18
19
19
20
export const meta : Route . MetaFunction = ( ) => {
@@ -88,7 +89,7 @@ export default function Index({
88
89
actionData,
89
90
loaderData,
90
91
} : Route . ComponentProps ) {
91
- const isLoadingSearchResults = useNavigation ( ) . state !== "idle" ;
92
+ const isNetworkBusy = useNetworkBusy ( ) ;
92
93
93
94
const {
94
95
topics,
@@ -127,7 +128,7 @@ export default function Index({
127
128
< SearchPagination
128
129
className = "ms-auto me-0"
129
130
currentQuery = { searchQuery }
130
- loading = { isLoadingSearchResults }
131
+ loading = { isNetworkBusy }
131
132
meta = { paginationMeta }
132
133
visibleItemCount = { notes . length }
133
134
/>
@@ -144,7 +145,7 @@ export default function Index({
144
145
< SearchPagination
145
146
className = "ms-auto me-0"
146
147
currentQuery = { searchQuery }
147
- loading = { isLoadingSearchResults }
148
+ loading = { isNetworkBusy }
148
149
meta = { paginationMeta }
149
150
visibleItemCount = { notes . length }
150
151
/>
0 commit comments