|
|
@@ -280,9 +280,47 @@ export default function Page() {
|
|
|
.finally(() => setUi("responding", false))
|
|
|
}
|
|
|
const sessionKey = createMemo(() => `${params.dir}${params.id ? "/" + params.id : ""}`)
|
|
|
+ const workspaceKey = createMemo(() => params.dir ?? "")
|
|
|
+ const workspaceTabs = createMemo(() => layout.tabs(workspaceKey))
|
|
|
const tabs = createMemo(() => layout.tabs(sessionKey))
|
|
|
const view = createMemo(() => layout.view(sessionKey))
|
|
|
|
|
|
+ createEffect(
|
|
|
+ on(
|
|
|
+ () => params.id,
|
|
|
+ (id, prev) => {
|
|
|
+ if (!id) return
|
|
|
+ if (prev) return
|
|
|
+
|
|
|
+ const pending = layout.handoff.tabs()
|
|
|
+ if (!pending) return
|
|
|
+ if (Date.now() - pending.at > 60_000) {
|
|
|
+ layout.handoff.clearTabs()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pending.id !== id) return
|
|
|
+ layout.handoff.clearTabs()
|
|
|
+ if (pending.dir !== (params.dir ?? "")) return
|
|
|
+
|
|
|
+ const from = workspaceTabs().tabs()
|
|
|
+ if (from.all.length === 0 && !from.active) return
|
|
|
+
|
|
|
+ const current = tabs().tabs()
|
|
|
+ if (current.all.length > 0 || current.active) return
|
|
|
+
|
|
|
+ const all = normalizeTabs(from.all)
|
|
|
+ const active = from.active ? normalizeTab(from.active) : undefined
|
|
|
+ tabs().setAll(all)
|
|
|
+ tabs().setActive(active && all.includes(active) ? active : all[0])
|
|
|
+
|
|
|
+ workspaceTabs().setAll([])
|
|
|
+ workspaceTabs().setActive(undefined)
|
|
|
+ },
|
|
|
+ { defer: true },
|
|
|
+ ),
|
|
|
+ )
|
|
|
+
|
|
|
if (import.meta.env.DEV) {
|
|
|
createEffect(
|
|
|
on(
|