fix(app): persist queued followups across project switches (#19421)

This commit is contained in:
Shoubhit Dash
2026-03-27 17:32:09 +05:30
committed by GitHub
parent 3fb60d05e5
commit d2bfa92e74

View File

@@ -57,12 +57,15 @@ import { TerminalPanel } from "@/pages/session/terminal-panel"
import { useSessionCommands } from "@/pages/session/use-session-commands" import { useSessionCommands } from "@/pages/session/use-session-commands"
import { useSessionHashScroll } from "@/pages/session/use-session-hash-scroll" import { useSessionHashScroll } from "@/pages/session/use-session-hash-scroll"
import { Identifier } from "@/utils/id" import { Identifier } from "@/utils/id"
import { Persist, persisted } from "@/utils/persist"
import { extractPromptFromParts } from "@/utils/prompt" import { extractPromptFromParts } from "@/utils/prompt"
import { same } from "@/utils/same" import { same } from "@/utils/same"
import { formatServerError } from "@/utils/server-errors" import { formatServerError } from "@/utils/server-errors"
const emptyUserMessages: UserMessage[] = [] 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 = { type SessionHistoryWindowInput = {
sessionID: () => string | undefined sessionID: () => string | undefined
@@ -512,15 +515,20 @@ export default function Page() {
deferRender: false, deferRender: false,
}) })
const [followup, setFollowup] = createStore({ const [followup, setFollowup] = persisted(
items: {} as Record<string, (FollowupDraft & { id: string })[] | undefined>, Persist.workspace(sdk.directory, "followup", ["followup.v1"]),
failed: {} as Record<string, string | undefined>, createStore<{
paused: {} as Record<string, boolean | undefined>, items: Record<string, FollowupItem[] | undefined>
edit: {} as Record< failed: Record<string, string | undefined>
string, paused: Record<string, boolean | undefined>
{ id: string; prompt: FollowupDraft["prompt"]; context: FollowupDraft["context"] } | undefined edit: Record<string, FollowupEdit | undefined>
>, }>({
}) items: {},
failed: {},
paused: {},
edit: {},
}),
)
createComputed((prev) => { createComputed((prev) => {
const key = sessionKey() const key = sessionKey()