Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Fix infinite reload on ontact list on error

fzaninotto88d1a746e00a
diff --git a/src/components/atomic-crm/contacts/ContactList.tsx b/src/components/atomic-crm/contacts/ContactList.tsx
index 4e9ad869..18d27526 100644
--- a/src/components/atomic-crm/contacts/ContactList.tsx
+++ b/src/components/atomic-crm/contacts/ContactList.tsx
@@ -69,6 +69,15 @@ const ContactListLayoutDesktop = () => {
);
};
+const ContactListActions = () => (
+ <TopToolbar>
+ <SortButton fields={["first_name", "last_name", "last_seen"]} />
+ <ContactImportButton />
+ <ExportButton exporter={exporter} />
+ <CreateButton />
+ </TopToolbar>
+);
+
export const ContactListMobile = () => {
const { identity } = useGetIdentity();
if (!identity) return null;
@@ -85,7 +94,7 @@ export const ContactListMobile = () => {
};
const ContactListLayoutMobile = () => {
- const { isPending, data, filterValues } = useListContext();
+ const { isPending, data, error, filterValues } = useListContext();
const hasFilters = filterValues && Object.keys(filterValues).length > 0;
@@ -99,23 +108,16 @@ const ContactListLayoutMobile = () => {
<MobileContent>
<ContactListFilterSummary />
<ContactListContentMobile />
- <div className="flex justify-center">
- <InfinitePagination />
- </div>
+ {!error && (
+ <div className="flex justify-center">
+ <InfinitePagination />
+ </div>
+ )}
</MobileContent>
</div>
);
};
-const ContactListActions = () => (
- <TopToolbar>
- <SortButton fields={["first_name", "last_name", "last_seen"]} />
- <ContactImportButton />
- <ExportButton exporter={exporter} />
- <CreateButton />
- </TopToolbar>
-);
-
const exporter: Exporter<Contact> = async (records, fetchRelatedRecords) => {
const companies = await fetchRelatedRecords<Company>(
records,