diff --git a/src/components/networkByIdPage/table/networkMembersTable.tsx b/src/components/networkByIdPage/table/networkMembersTable.tsx index e2ac9d46..fd2c98b5 100644 --- a/src/components/networkByIdPage/table/networkMembersTable.tsx +++ b/src/components/networkByIdPage/table/networkMembersTable.tsx @@ -64,6 +64,7 @@ export const NetworkMembersTable = ({ nwid, central = false, organizationId }: I () => networkById?.members ?? [], [networkById?.members], ); + // const memoizedFakeMembers = useMemo(() => makeNetworkMemberData(100) ?? [], []); // Save to localStorage whenever sorting changes useEffect(() => { @@ -74,7 +75,6 @@ export const NetworkMembersTable = ({ nwid, central = false, organizationId }: I setData(memoizedMembers); }, [memoizedMembers]); - // const [data, setData] = useState(() => makeNetworkMemberData(11)); const [data, setData] = useState(networkById?.members ?? []); const columnsHeader = MemberHeaderColumns({ nwid, central, organizationId }); const defaultColumn = MemberEditCell({ nwid, central, organizationId }); diff --git a/src/components/shared/tableFooter.tsx b/src/components/shared/tableFooter.tsx index cd30ceaf..79f191b1 100644 --- a/src/components/shared/tableFooter.tsx +++ b/src/components/shared/tableFooter.tsx @@ -40,10 +40,11 @@ const MIN_COUNT_TO_SHOW_FOOTER = 11; // biome-ignore lint/suspicious/noExplicitAny: const TableFooter = ({ table, page }: { table: Table; page: string }) => { - const t = useTranslations("commonTable"); // use the 'footer' namespace + const t = useTranslations("commonTable"); const [pageSize, setPageSize] = useState( table.getState().pagination.pageSize, ); + const totalMembersCount = table?.options?.data?.length || 0; // biome-ignore lint/correctness/useExhaustiveDependencies: @@ -52,10 +53,10 @@ const TableFooter = ({ table, page }: { table: Table; page: string }) => { setPageSize(savedPageSize || 10); if (savedPageSize !== null) { table.setPageSize( - savedPageSize === "all" ? table?.options?.data?.length : Number(savedPageSize), + savedPageSize === "all" ? totalMembersCount : Number(savedPageSize), ); } - }, []); + }, [totalMembersCount]); const storeLocalState = (pageSize) => { table.setPageSize(pageSize === "all" ? totalMembersCount : Number(pageSize)); diff --git a/src/utils/fakeData.ts b/src/utils/fakeData.ts index 8c50e59b..c87a3797 100644 --- a/src/utils/fakeData.ts +++ b/src/utils/fakeData.ts @@ -43,8 +43,13 @@ const newMembers = (): Partial => { return { nwid: faker.string.uuid(), id: faker.string.hexadecimal({ length: 10 }).substring(2), + creationTime: faker.date.past().getTime(), + lastSeen: faker.date.recent().toISOString(), // online: faker.datatype.boolean(), name: faker.person.firstName(), + authenticationExpiryTime: faker.date.future().getTime(), + lastAuthorizedTime: faker.date.recent().getTime(), + lastDeauthorizedTime: faker.date.recent().getTime(), // age: faker.datatype.number(40), // visits: faker.datatype.number(1000), // progress: faker.datatype.number(100),