From 4f07a2cc2abd856d935de8f4eb6f04bf90fb246a Mon Sep 17 00:00:00 2001 From: pengx17 Date: Thu, 27 Jun 2024 10:37:43 +0000 Subject: [PATCH] fix(core): debounce doc update time update (#7363) --- .../core/src/components/affine/page-properties/table.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/frontend/core/src/components/affine/page-properties/table.tsx b/packages/frontend/core/src/components/affine/page-properties/table.tsx index 302ed9b939..e9b15e8708 100644 --- a/packages/frontend/core/src/components/affine/page-properties/table.tsx +++ b/packages/frontend/core/src/components/affine/page-properties/table.tsx @@ -48,6 +48,7 @@ import { } from '@toeverything/infra'; import clsx from 'clsx'; import { use } from 'foxact/use'; +import { useDebouncedValue } from 'foxact/use-debounced-value'; import { atom, useAtomValue, useSetAtom } from 'jotai'; import type React from 'react'; import type { @@ -674,6 +675,8 @@ export const PagePropertiesTableHeader = ({ t, ]); + const dTimestampElement = useDebouncedValue(timestampElement, 500); + const handleCollapse = useCallback(() => { onOpenChange(!open); }, [onOpenChange, open]); @@ -691,7 +694,7 @@ export const PagePropertiesTableHeader = ({ ) : null} - {timestampElement} + {dTimestampElement}