diff options
| author | Adam <[email protected]> | 2026-02-19 11:36:32 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2026-02-19 11:36:37 -0600 |
| commit | f2858a42ba17fba1e3376440e8f3aae2aa64ca61 (patch) | |
| tree | 3fbc753ccb26a79f015aa7a6dd71f384348e383a /packages/app/src/pages/layout | |
| parent | 3c21735b35f779d69a5458b1fa5fada49fb7decb (diff) | |
| download | opencode-f2858a42ba17fba1e3376440e8f3aae2aa64ca61.tar.gz opencode-f2858a42ba17fba1e3376440e8f3aae2aa64ca61.zip | |
chore: cleanup
Diffstat (limited to 'packages/app/src/pages/layout')
| -rw-r--r-- | packages/app/src/pages/layout/helpers.test.ts | 39 | ||||
| -rw-r--r-- | packages/app/src/pages/layout/helpers.ts | 18 |
2 files changed, 1 insertions, 56 deletions
diff --git a/packages/app/src/pages/layout/helpers.test.ts b/packages/app/src/pages/layout/helpers.test.ts index 6f868ab69..83d8f4748 100644 --- a/packages/app/src/pages/layout/helpers.test.ts +++ b/packages/app/src/pages/layout/helpers.test.ts @@ -1,13 +1,6 @@ import { describe, expect, test } from "bun:test" import { collectOpenProjectDeepLinks, drainPendingDeepLinks, parseDeepLink } from "./deep-links" -import { - displayName, - errorMessage, - getDraggableId, - projectSessionTarget, - syncWorkspaceOrder, - workspaceKey, -} from "./helpers" +import { displayName, errorMessage, getDraggableId, syncWorkspaceOrder, workspaceKey } from "./helpers" describe("layout deep links", () => { test("parses open-project deep links", () => { @@ -96,34 +89,4 @@ describe("layout workspace helpers", () => { expect(errorMessage(new Error("broken"), "fallback")).toBe("broken") expect(errorMessage("unknown", "fallback")).toBe("fallback") }) - - test("picks newest session across project workspaces", () => { - const result = projectSessionTarget({ - directory: "/root", - project: { worktree: "/root", sandboxes: ["/root/a", "/root/b"] }, - lastSession: { - "/root": "root-session", - "/root/a": "sandbox-a", - "/root/b": "sandbox-b", - }, - lastSessionAt: { - "/root": 1, - "/root/a": 3, - "/root/b": 2, - }, - }) - - expect(result).toEqual({ directory: "/root/a", id: "sandbox-a", at: 3 }) - }) - - test("falls back to project route when no session exists", () => { - const result = projectSessionTarget({ - directory: "/root", - project: { worktree: "/root", sandboxes: ["/root/a"] }, - lastSession: {}, - lastSessionAt: {}, - }) - - expect(result).toEqual({ directory: "/root" }) - }) }) diff --git a/packages/app/src/pages/layout/helpers.ts b/packages/app/src/pages/layout/helpers.ts index 88066cfb8..6a1e7c012 100644 --- a/packages/app/src/pages/layout/helpers.ts +++ b/packages/app/src/pages/layout/helpers.ts @@ -62,24 +62,6 @@ export const errorMessage = (err: unknown, fallback: string) => { return fallback } -export function projectSessionTarget(input: { - directory: string - project?: { worktree: string; sandboxes?: string[] } - lastSession: Record<string, string> - lastSessionAt: Record<string, number> -}): { directory: string; id?: string; at?: number } { - const dirs = input.project ? [input.project.worktree, ...(input.project.sandboxes ?? [])] : [input.directory] - const best = dirs.reduce<{ directory: string; id: string; at: number } | undefined>((result, directory) => { - const id = input.lastSession[directory] - if (!id) return result - const at = input.lastSessionAt[directory] ?? 0 - if (result && result.at >= at) return result - return { directory, id, at } - }, undefined) - if (best) return best - return { directory: input.directory } -} - export const syncWorkspaceOrder = (local: string, dirs: string[], existing?: string[]) => { if (!existing) return dirs const keep = existing.filter((d) => d !== local && dirs.includes(d)) |
