From cd74c6eeea58a0bf26eb8ba8b1a6ba6430c142a9 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Sun, 28 Sep 2025 03:59:44 -0400 Subject: [PATCH] sync --- .../src/cli/cmd/tui/routes/session/index.tsx | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index f0b86cea5..22a67c8a8 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -54,6 +54,12 @@ export function Session() { }, 50) } + // snap to bottom when revert position changes + createEffect((old) => { + if (old !== session()?.revert?.messageID) toBottom() + return session()?.revert?.messageID + }) + const local = useLocal() const command = useCommandDialog() @@ -115,16 +121,14 @@ export function Session() { const revert = session().revert?.messageID const message = messages().findLast((x) => (!revert || x.id < revert) && x.role === "user") if (!message) return - sdk.session - .revert({ - path: { - id: route.sessionID, - }, - body: { - messageID: message.id, - }, - }) - .then(toBottom) + sdk.session.revert({ + path: { + id: route.sessionID, + }, + body: { + messageID: message.id, + }, + }) dialog.clear() }, }, @@ -138,25 +142,21 @@ export function Session() { if (!messageID) return const message = messages().find((x) => x.role === "user" && x.id > messageID) if (!message) { - sdk.session - .unrevert({ - path: { - id: route.sessionID, - }, - }) - .then(toBottom) - return - } - sdk.session - .revert({ + sdk.session.unrevert({ path: { id: route.sessionID, }, - body: { - messageID: message.id, - }, }) - .then(toBottom) + return + } + sdk.session.revert({ + path: { + id: route.sessionID, + }, + body: { + messageID: message.id, + }, + }) }, }, ])