From 7ce31c1594c60ea6b48ceb01df23acc3a5689de1 Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Mon, 26 Jan 2026 21:49:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20fix=20resource=20pages=20?= =?UTF-8?q?(#11863)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix resource pages --- src/features/ResourceManager/index.tsx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/features/ResourceManager/index.tsx b/src/features/ResourceManager/index.tsx index bc0f2b5895..2aa11f1775 100644 --- a/src/features/ResourceManager/index.tsx +++ b/src/features/ResourceManager/index.tsx @@ -71,6 +71,7 @@ const ResourceManager = memo(() => { const currentDocument = useFileStore(documentSelectors.getDocumentById(currentViewItemId)); const pushDockFileList = useFileStore((s) => s.pushDockFileList); + const updateDocumentOptimistically = useFileStore((s) => s.updateDocumentOptimistically); const handleUploadFiles = useCallback( (files: File[]) => pushDockFileList(files, libraryId, currentFolderId ?? undefined), @@ -111,6 +112,27 @@ const ResourceManager = memo(() => { document.title = BRANDING_NAME; }; + // Optimistic update handlers for page title and emoji + const handleTitleChange = useCallback( + (newTitle: string) => { + if (currentViewItemId) { + updateDocumentOptimistically(currentViewItemId, { title: newTitle }); + } + }, + [currentViewItemId, updateDocumentOptimistically], + ); + + const handleEmojiChange = useCallback( + (newEmoji: string | undefined) => { + if (currentViewItemId) { + updateDocumentOptimistically(currentViewItemId, { + metadata: { ...currentDocument?.metadata, emoji: newEmoji }, + }); + } + }, + [currentViewItemId, currentDocument?.metadata, updateDocumentOptimistically], + ); + return ( <> { {mode === 'page' && ( )}