Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
bf7b631c1f
commit
475595647d
@@ -210,6 +210,21 @@ function InvoicesIndex() {
|
||||
[visibleExp],
|
||||
);
|
||||
|
||||
// Reset to page 0 when filter or underlying data changes
|
||||
useEffect(() => { setTimePage(0); }, [timeFilter, time.length]);
|
||||
useEffect(() => { setExpPage(0); }, [expFilter, expenses.length]);
|
||||
|
||||
const timeTotalPages = Math.max(1, Math.ceil(visibleTime.length / TAB_PAGE_SIZE));
|
||||
const expTotalPages = Math.max(1, Math.ceil(visibleExp.length / TAB_PAGE_SIZE));
|
||||
const pagedTime = useMemo(
|
||||
() => visibleTime.slice(timePage * TAB_PAGE_SIZE, (timePage + 1) * TAB_PAGE_SIZE),
|
||||
[visibleTime, timePage],
|
||||
);
|
||||
const pagedExp = useMemo(
|
||||
() => visibleExp.slice(expPage * TAB_PAGE_SIZE, (expPage + 1) * TAB_PAGE_SIZE),
|
||||
[visibleExp, expPage],
|
||||
);
|
||||
|
||||
const toggleSel = (set: Set<string>, id: string) => {
|
||||
const next = new Set(set);
|
||||
if (next.has(id)) next.delete(id); else next.add(id);
|
||||
|
||||
Reference in New Issue
Block a user