From c0931b2d9357c8ea53d43e05782b0fa6ad0fcf39 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 20 Feb 2024 00:54:15 +0800 Subject: [PATCH] fix: post editor editing status not updated --- .../[locale]/dashboard/[subdomain]/editor/post-editor.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/[locale]/dashboard/[subdomain]/editor/post-editor.tsx b/src/app/[locale]/dashboard/[subdomain]/editor/post-editor.tsx index e69feb99..1b94327f 100644 --- a/src/app/[locale]/dashboard/[subdomain]/editor/post-editor.tsx +++ b/src/app/[locale]/dashboard/[subdomain]/editor/post-editor.tsx @@ -141,7 +141,8 @@ export default function PostEditor() { const updateValue = useCallback( (val: EditorValues) => { - if (visibility !== PageVisibilityEnum.Draft) { + const _visibility = getPageVisibility(page.data || undefined) // can't get the correct visibility here, very strange + if (_visibility !== PageVisibilityEnum.Draft) { setVisibility(PageVisibilityEnum.Modified) } @@ -176,7 +177,7 @@ export default function PostEditor() { } useEditorState.setState(newValues) }, - [visibility, site.data?.characterId, type, queryClient], + [visibility, site.data?.characterId, type, queryClient, page.data], ) const isMobileLayout = useIsMobileLayout()