From 65d069949def7afaf66080d02cdc2ad63b55c0cd Mon Sep 17 00:00:00 2001 From: "ryunosuke.ito" Date: Sun, 1 Mar 2026 16:13:44 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=83=89=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E3=83=A1=E3=83=A2=E4=B8=80=E8=A6=A7=E3=82=92=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=A5=E3=81=AE=E9=99=8D=E9=A0=86=E3=81=A7=E3=82=BD?= =?UTF-8?q?=E3=83=BC=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updateCurrentBody でメモの updated_at を更新した後、リストを再ソートする ことで、編集したメモが即座にサイドバーの先頭に移動するようにした。 Co-Authored-By: Claude Opus 4.6 --- src/hooks/useMemos.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/hooks/useMemos.ts b/src/hooks/useMemos.ts index 47591c2..ad68e7c 100644 --- a/src/hooks/useMemos.ts +++ b/src/hooks/useMemos.ts @@ -59,11 +59,17 @@ export function useMemos() { setCurrentMemo((prev) => (prev ? { ...prev, body } : null)); const title = extractTitle(body); setMemos((prev) => - prev.map((m) => - m.id === currentMemo.meta.id - ? { ...m, title, updated_at: new Date().toISOString() } - : m, - ), + prev + .map((m) => + m.id === currentMemo.meta.id + ? { ...m, title, updated_at: new Date().toISOString() } + : m, + ) + .sort( + (a, b) => + new Date(b.updated_at).getTime() - + new Date(a.updated_at).getTime(), + ), ); }, [currentMemo],