fix(app): prevent stale prompt control reads (#39842)

This commit is contained in:
OpeOginni 2026-08-01 11:46:46 +02:00 committed by GitHub
commit f67e80c275
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -212,20 +212,20 @@ export function PromptInputV2(props: PromptInputV2Props) {
onContext={props.controller.openContext} onContext={props.controller.openContext}
onShell={props.controller.openShell} onShell={props.controller.openShell}
/> />
<Show when={view.agent}> <Show when={view.agent} keyed>
{(control) => ( {(control) => (
<PromptInputV2ConfiguredSelect title="Choose agent" keybind={["Mod", "."]} control={control()} /> <PromptInputV2ConfiguredSelect title="Choose agent" keybind={["Mod", "."]} control={control} />
)} )}
</Show> </Show>
<Show <Show
when={props.modelControl} when={props.modelControl}
fallback={ fallback={
<Show when={view.model}> <Show when={view.model} keyed>
{(control) => ( {(control) => (
<PromptInputV2ConfiguredSelect <PromptInputV2ConfiguredSelect
title="Choose model" title="Choose model"
keybind={["Mod", "M"]} keybind={["Mod", "M"]}
control={control()} control={control}
model model
/> />
)} )}
@ -234,13 +234,13 @@ export function PromptInputV2(props: PromptInputV2Props) {
> >
{props.modelControl} {props.modelControl}
</Show> </Show>
<Show when={(props.variantControlVisible ?? true) && view.variant}> <Show when={(props.variantControlVisible ?? true) && view.variant} keyed>
{(control) => ( {(control) => (
<Show when={control().options().length > 1}> <Show when={control.options().length > 1}>
<PromptInputV2ConfiguredSelect <PromptInputV2ConfiguredSelect
title="Choose model variant" title="Choose model variant"
keybind={["Shift", "Mod", "D"]} keybind={["Shift", "Mod", "D"]}
control={control()} control={control}
/> />
</Show> </Show>
)} )}