Skip to content

Commit 3a31896

Browse files
authored
🐛 Remove unnecessary initialData from useQuery calls (#1940)
Initial data is persisted in cache which results in: 1. isLoading flag always false 2. with custom staleTime, delaying first fetch until cache expires Signed-off-by: Radoslaw Szwajkowski <[email protected]>
1 parent 15c8ee4 commit 3a31896

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

client/src/app/queries/applications.ts

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const useFetchApplications = (
3737
) => {
3838
const queryClient = useQueryClient();
3939
const { isLoading, error, refetch, data } = useQuery({
40-
initialData: [],
4140
queryKey: [ApplicationsQueryKey],
4241
queryFn: getApplications,
4342
refetchInterval: refetchInterval,

client/src/app/queries/archetypes.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ export const useFetchArchetypes = (forApplication?: Application | null) => {
1919
const [filteredArchetypes, setFilteredArchetypes] = useState<Archetype[]>([]);
2020

2121
const queryClient = useQueryClient();
22-
const { isLoading, isSuccess, error, refetch, data } = useQuery({
23-
initialData: [],
22+
const { isLoading, isSuccess, error, refetch } = useQuery({
2423
queryKey: [ARCHETYPES_QUERY_KEY, forApplication?.id],
2524
queryFn: getArchetypes,
2625
onSuccess: (fetchedArchetypes) => {

0 commit comments

Comments
 (0)