fix: add missing trashDate field whenever a page is moved to the trash. (#1389)

Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
sheben
2023-03-08 03:30:25 +08:00
committed by GitHub
parent b7b946f002
commit 3b8f7536f3
4 changed files with 6 additions and 2 deletions

View File

@@ -19,7 +19,9 @@ export const DateCell = ({
const value = pageMeta[dateKey] ?? pageMeta[backupKey];
return (
<TableCell ellipsis={true} {...props}>
{value ? dayjs(value as string).format('YYYY-MM-DD HH:mm') : '--'}
{typeof value === 'number'
? dayjs(value).format('YYYY-MM-DD HH:mm')
: '--'}
</TableCell>
);
};

View File

@@ -212,6 +212,7 @@ export const PageList: React.FC<PageListProps> = ({
onToggleTrashPage={() => {
helper.setPageMeta(pageMeta.id, {
trash: !pageMeta.trash,
trashDate: +new Date(),
});
}}
/>

View File

@@ -97,7 +97,7 @@ const PopoverContent = () => {
data-testid="editor-option-menu-delete"
onClick={() => {
// fixme(himself65): regression that don't have conform dialog
setPageMeta(pageId, { trash: !trash });
setPageMeta(pageId, { trash: !trash, trashDate: +new Date() });
toast(t('Moved to Trash'));
}}
icon={<DeleteTemporarilyIcon />}

View File

@@ -8,6 +8,7 @@ declare module '@blocksuite/store' {
mode?: 'page' | 'edgeless';
favorite?: boolean;
trash?: boolean;
trashDate?: number;
}
}