Refetch space list on mount

This commit is contained in:
Philipinho 2025-03-17 11:49:42 +00:00
parent 2e5990d057
commit 442fa23399
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,5 @@
import { Text, Avatar, SimpleGrid, Card, rem } from "@mantine/core"; import { Text, Avatar, SimpleGrid, Card, rem } from "@mantine/core";
import React from "react"; import React, { useEffect } from 'react';
import { import {
prefetchSpace, prefetchSpace,
useGetSpacesQuery, useGetSpacesQuery,
@ -12,7 +12,7 @@ import { useTranslation } from "react-i18next";
export default function SpaceGrid() { export default function SpaceGrid() {
const { t } = useTranslation(); const { t } = useTranslation();
const { data, isLoading } = useGetSpacesQuery(); const { data, isLoading } = useGetSpacesQuery({ page: 1 });
const cards = data?.items.map((space, index) => ( const cards = data?.items.map((space, index) => (
<Card <Card

View File

@ -38,6 +38,7 @@ export function useGetSpacesQuery(
queryKey: ["spaces", params], queryKey: ["spaces", params],
queryFn: () => getSpaces(params), queryFn: () => getSpaces(params),
placeholderData: keepPreviousData, placeholderData: keepPreviousData,
refetchOnMount: true,
}); });
} }