From 8898de7bfb95badb9cd617e88fe0923e390c11ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 22 Sep 2024 21:18:22 +0200 Subject: [PATCH] pl-fe: fix after react-query update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts | 2 +- packages/pl-fe/src/features/admin/announcements.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts b/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts index 43eaf91240..a17eebc1cf 100644 --- a/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts +++ b/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts @@ -25,7 +25,7 @@ const useAnnouncements = () => { const result = useQuery>({ queryKey: ['admin', 'announcements'], queryFn: getAnnouncements, - placeholderData: [], + placeholderData: [] as ReadonlyArray, }); const { diff --git a/packages/pl-fe/src/features/admin/announcements.tsx b/packages/pl-fe/src/features/admin/announcements.tsx index fe1473bd71..772c135611 100644 --- a/packages/pl-fe/src/features/admin/announcements.tsx +++ b/packages/pl-fe/src/features/admin/announcements.tsx @@ -88,7 +88,7 @@ const Announcements: React.FC = () => { const intl = useIntl(); const { openModal } = useModalsStore(); - const { data: announcements, isLoading } = useAnnouncements(); + const { data: announcements, isLoading, isPending } = useAnnouncements(); const handleCreateAnnouncement = () => { openModal('EDIT_ANNOUNCEMENT'); @@ -112,7 +112,7 @@ const Announcements: React.FC = () => { emptyMessage={emptyMessage} itemClassName='py-3 first:pt-0 last:pb-0' isLoading={isLoading} - showLoading={isLoading && !announcements?.length} + showLoading={isLoading && isPending} > {announcements!.map((announcement) => (