From 442fa233990641560ec0bcdcb0e53846c81c7e9b Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Mon, 17 Mar 2025 11:49:42 +0000 Subject: [PATCH] Refetch space list on mount --- apps/client/src/features/space/components/space-grid.tsx | 4 ++-- apps/client/src/features/space/queries/space-query.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/client/src/features/space/components/space-grid.tsx b/apps/client/src/features/space/components/space-grid.tsx index b1f93510..4680a336 100644 --- a/apps/client/src/features/space/components/space-grid.tsx +++ b/apps/client/src/features/space/components/space-grid.tsx @@ -1,5 +1,5 @@ import { Text, Avatar, SimpleGrid, Card, rem } from "@mantine/core"; -import React from "react"; +import React, { useEffect } from 'react'; import { prefetchSpace, useGetSpacesQuery, @@ -12,7 +12,7 @@ import { useTranslation } from "react-i18next"; export default function SpaceGrid() { const { t } = useTranslation(); - const { data, isLoading } = useGetSpacesQuery(); + const { data, isLoading } = useGetSpacesQuery({ page: 1 }); const cards = data?.items.map((space, index) => ( getSpaces(params), placeholderData: keepPreviousData, + refetchOnMount: true, }); }