fix(tui): default new sessions always to local project (#28541)

This commit is contained in:
James Long
2026-05-20 18:35:37 -04:00
committed by GitHub
parent 6a9cbe7de0
commit a6e1aa085f
4 changed files with 4 additions and 25 deletions

View File

@@ -64,7 +64,6 @@ import { useTuiConfig } from "../../context/tui-config"
export type PromptProps = {
sessionID?: string
workspaceID?: string
visible?: boolean
disabled?: boolean
onSubmit?: () => void
@@ -201,7 +200,6 @@ export function Prompt(props: PromptProps) {
const [cursorVersion, setCursorVersion] = createSignal(0)
const currentProviderLabel = createMemo(() => local.model.parsed().provider)
const hasRightContent = createMemo(() => Boolean(props.right))
const defaultWorkspaceID = createMemo(() => props.workspaceID ?? project.workspace.current())
function selectWorkspace(selection: WorkspaceSelection | undefined) {
setWorkspaceSelection(selection)
@@ -1061,7 +1059,7 @@ export function Prompt(props: PromptProps) {
if (sessionID == null) {
const workspace = workspaceSelection()
const workspaceID = iife(() => {
if (!workspace) return defaultWorkspaceID()
if (!workspace) return undefined
if (workspace.type === "none") return undefined
if (workspace.type === "existing") return workspace.workspaceID
return undefined
@@ -1422,17 +1420,7 @@ export function Prompt(props: PromptProps) {
| undefined
>(() => {
const selected = workspaceSelection()
if (!selected) {
const workspaceID = defaultWorkspaceID()
if (props.sessionID || !workspaceID) return
const workspace = project.workspace.get(workspaceID)
return {
type: "existing",
workspaceType: workspace?.type ?? "unknown",
workspaceName: workspace?.name ?? workspaceID,
status: project.workspace.status(workspaceID) ?? "error",
}
}
if (!selected) return
if (selected.type === "none") return
if (props.sessionID && !workspaceCreating()) return
if (selected.type === "new") {

View File

@@ -277,7 +277,6 @@ export function createTuiApi(input: Input): TuiPluginApi {
return (
<Prompt
sessionID={props.sessionID}
workspaceID={props.workspaceID}
visible={props.visible}
disabled={props.disabled}
onSubmit={props.onSubmit}

View File

@@ -1,7 +1,6 @@
import { Prompt, type PromptRef } from "@tui/component/prompt"
import { createEffect, createSignal, onMount } from "solid-js"
import { Logo } from "../component/logo"
import { useProject } from "../context/project"
import { useSync } from "../context/sync"
import { Toast } from "../ui/toast"
import { useArgs } from "../context/args"
@@ -19,7 +18,6 @@ const placeholder = {
export function Home() {
const sync = useSync()
const project = useProject()
const route = useRouteData("home")
const promptRef = usePromptRef()
const [ref, setRef] = createSignal<PromptRef | undefined>()
@@ -73,13 +71,11 @@ export function Home() {
<TuiPluginRuntime.Slot
name="home_prompt"
mode="replace"
workspace_id={project.workspace.current()}
ref={bind}
>
<Prompt
ref={bind}
workspaceID={project.workspace.current()}
right={<TuiPluginRuntime.Slot name="home_prompt_right" workspace_id={project.workspace.current()} />}
right={<TuiPluginRuntime.Slot name="home_prompt_right" />}
placeholders={placeholder}
/>
</TuiPluginRuntime.Slot>

View File

@@ -210,7 +210,6 @@ export type TuiPromptRef = {
export type TuiPromptProps = {
sessionID?: string
workspaceID?: string
visible?: boolean
disabled?: boolean
onSubmit?: () => void
@@ -458,12 +457,9 @@ export type TuiHostSlotMap = {
app_bottom: {}
home_logo: {}
home_prompt: {
workspace_id?: string
ref?: (ref: TuiPromptRef | undefined) => void
}
home_prompt_right: {
workspace_id?: string
}
home_prompt_right: {}
session_prompt: {
session_id: string
visible?: boolean