From 2f511500bfeaee4e20128fc82fce285fab5a2c3f Mon Sep 17 00:00:00 2001 From: YuanShiJiLoong <2450829984@qq.com> Date: Tue, 24 Feb 2026 21:05:06 +0900 Subject: [PATCH] fix: createChapter is async, must await before using result --- app/components/Sidebar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/Sidebar.js b/app/components/Sidebar.js index 43b0417..1d860e6 100644 --- a/app/components/Sidebar.js +++ b/app/components/Sidebar.js @@ -45,9 +45,9 @@ export default function Sidebar() { }, [chapters, t]); // 创建新章节 — 一键创建并进入重命名模式 - const handleCreateChapter = useCallback(() => { + const handleCreateChapter = useCallback(async () => { const title = getNextChapterTitle(); - const ch = createChapter(title); + const ch = await createChapter(title); addChapter(ch); setActiveChapterId(ch.id); // 立即进入重命名模式,方便用户修改标题