mirror of
https://github.com/docmost/docmost.git
synced 2026-09-01 03:15:32 +08:00
fix(base): stabilize properties identity to break render loop
This commit is contained in:
@@ -185,7 +185,11 @@ export function useBaseTable(
|
|||||||
const updateViewMutation = useUpdateViewMutation();
|
const updateViewMutation = useUpdateViewMutation();
|
||||||
const persistTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
const persistTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||||
|
|
||||||
const properties = base?.properties ?? [];
|
// `base?.properties ?? []` minted a fresh `[]` every render while the
|
||||||
|
// base query was loading, which invalidated every downstream memo and
|
||||||
|
// tripped the setState-in-useEffect pairs below → "Maximum update
|
||||||
|
// depth exceeded". Memoize so the identity is stable.
|
||||||
|
const properties = useMemo(() => base?.properties ?? [], [base?.properties]);
|
||||||
const viewConfig = activeView?.config;
|
const viewConfig = activeView?.config;
|
||||||
|
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
|
|||||||
Reference in New Issue
Block a user