The open source coding agent.
TypeScript
tui: fix dialog replacement to prevent nested dialogs from showing simultaneously
Dax Raad416a919c6dd4
diff --git a/packages/ui/src/context/dialog.tsx b/packages/ui/src/context/dialog.tsxindex 50e41c5966a..b15d9699114 100644--- a/packages/ui/src/context/dialog.tsx+++ b/packages/ui/src/context/dialog.tsx@@ -22,6 +22,7 @@ const Context = createContext<ReturnType<typeof init>>()function init() {const [store, setStore] = createSignal<{+ id: stringelement: DialogElementonClose?: () => voidowner: Owner@@ -45,11 +46,13 @@ function init() {for (const item of store()) {item.onClose?.()}+ const id = Math.random().toString(36)setStore([{+ id,element: () =>runWithOwner(owner, () => (- <Show when={result.stack.at(-1)?.owner === owner}>+ <Show when={result.stack.at(-1)?.id === id}><KobaltemodaldefaultOpen@@ -79,11 +82,15 @@ function init() {setStore([])},}+return result}export function DialogProvider(props: ParentProps) {const ctx = init()+ createEffect(() => {+ console.log("store", ctx.stack.length)+ })return (<Context.Provider value={ctx}>{props.children}