mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-28 00:35:28 +00:00
fix(app): persist queued followups across project switches (#19421)
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user