fix(app): separate provider lifetimes and reactive ownership (#33739)

This commit is contained in:
Luke Parker
2026-06-25 04:42:06 +00:00
committed by GitHub
parent dc569b5a5f
commit cfd75d62fe
37 changed files with 837 additions and 273 deletions
@@ -0,0 +1,36 @@
import { expect, test } from "bun:test"
import { createRoot, createSignal } from "solid-js"
import { createPromptInputTransientState } from "@/components/prompt-input/transient-state"
test("resets transient prompt input state when the prompt session changes", () => {
createRoot((dispose) => {
const [identity, setIdentity] = createSignal("A")
const [state, setState] = createPromptInputTransientState(identity, 3)
setState({
popover: "slash",
historyIndex: 2,
savedPrompt: {
prompt: [{ type: "text", content: "draft-A", start: 0, end: 7 }],
comments: [],
},
draggingType: "image",
mode: "shell",
applyingHistory: true,
variantOpen: true,
})
setIdentity("B")
expect(state).toMatchObject({
popover: null,
historyIndex: -1,
savedPrompt: null,
placeholder: 3,
draggingType: null,
mode: "normal",
applyingHistory: false,
variantOpen: false,
})
dispose()
})
})