diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-12-18 11:38:06 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-12-18 11:38:06 +0100 |
| commit | d7f92841232c257279106c8eef226ce8ea74ecd0 (patch) | |
| tree | 4bdb9ebd03ed39f39d418332f8479f5beec014a7 /src/utils/hooks/use-thematics-list/use-thematics-list.ts | |
| parent | b0ebd69d5b5f6dfed4e82528dff1b913a4240dc8 (diff) | |
fix(pages): do not show spinner when data are available
The `useSWR` hook set `isLoading` to `true` on first fetch even if
the fallback data is provided. It affects how pages are generated on
build: the loading page is showing instead of the actual page. So we
need to return a custom `isLoading` variable that checks if there is no
data.
Diffstat (limited to 'src/utils/hooks/use-thematics-list/use-thematics-list.ts')
| -rw-r--r-- | src/utils/hooks/use-thematics-list/use-thematics-list.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/utils/hooks/use-thematics-list/use-thematics-list.ts b/src/utils/hooks/use-thematics-list/use-thematics-list.ts index f63815a..aafc3ad 100644 --- a/src/utils/hooks/use-thematics-list/use-thematics-list.ts +++ b/src/utils/hooks/use-thematics-list/use-thematics-list.ts @@ -43,7 +43,7 @@ export const useThematicsList = < return { isError: !!error, - isLoading, + isLoading: isLoading && !data, isValidating, thematics: data, } as UseThematicsListReturn<T>; |
