diff options
| author | Shoubhit Dash <[email protected]> | 2026-03-27 17:32:09 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-27 12:02:09 +0000 |
| commit | d2bfa92e7438eb7ac7c4e2d72fca708f27c52ba3 (patch) | |
| tree | 1f3d626e426875b6bfdc19a56a7c70d20d393a9c /packages/app | |
| parent | 3fb60d05e555dad020d3354602affe166ef0cc22 (diff) | |
| download | opencode-d2bfa92e7438eb7ac7c4e2d72fca708f27c52ba3.tar.gz opencode-d2bfa92e7438eb7ac7c4e2d72fca708f27c52ba3.zip | |
fix(app): persist queued followups across project switches (#19421)
Diffstat (limited to 'packages/app')
| -rw-r--r-- | packages/app/src/pages/session.tsx | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsx index c41133ded..752b549b8 100644 --- a/packages/app/src/pages/session.tsx +++ b/packages/app/src/pages/session.tsx @@ -57,12 +57,15 @@ import { TerminalPanel } from "@/pages/session/terminal-panel" import { useSessionCommands } from "@/pages/session/use-session-commands" import { useSessionHashScroll } from "@/pages/session/use-session-hash-scroll" import { Identifier } from "@/utils/id" +import { Persist, persisted } from "@/utils/persist" import { extractPromptFromParts } from "@/utils/prompt" import { same } from "@/utils/same" import { formatServerError } from "@/utils/server-errors" const emptyUserMessages: UserMessage[] = [] -const emptyFollowups: (FollowupDraft & { id: string })[] = [] +type FollowupItem = FollowupDraft & { id: string } +type FollowupEdit = Pick<FollowupItem, "id" | "prompt" | "context"> +const emptyFollowups: FollowupItem[] = [] type SessionHistoryWindowInput = { sessionID: () => string | undefined @@ -512,15 +515,20 @@ export default function Page() { deferRender: false, }) - const [followup, setFollowup] = createStore({ - items: {} as Record<string, (FollowupDraft & { id: string })[] | undefined>, - failed: {} as Record<string, string | undefined>, - paused: {} as Record<string, boolean | undefined>, - edit: {} as Record< - string, - { id: string; prompt: FollowupDraft["prompt"]; context: FollowupDraft["context"] } | undefined - >, - }) + const [followup, setFollowup] = persisted( + Persist.workspace(sdk.directory, "followup", ["followup.v1"]), + createStore<{ + items: Record<string, FollowupItem[] | undefined> + failed: Record<string, string | undefined> + paused: Record<string, boolean | undefined> + edit: Record<string, FollowupEdit | undefined> + }>({ + items: {}, + failed: {}, + paused: {}, + edit: {}, + }), + ) createComputed((prev) => { const key = sessionKey() |
