Repository navigation
refactor(mobile): opening Review or Files shows the inspector in the first commit #25817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+162
−75
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
677ff55
refactor(mobile): workspace layout reveals the review and files inspe…
juliusmarminge 3727278
fix(mobile): Files reveal waits for a working directory and Back keep…
juliusmarminge a4404ae
fix(mobile): Files reveal resolves the project from loaded thread detail
juliusmarminge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
apps/mobile/src/state/use-selected-thread-worktree.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import { EnvironmentId, ProjectId, ThreadId } from "@t3tools/contracts"; | ||
| import { describe, expect, it, vi } from "vite-plus/test"; | ||
|
|
||
| const state = vi.hoisted(() => ({ | ||
| shell: null as { projectId: string; worktreePath: string | null } | null, | ||
| detail: null as { thread: { projectId: string } } | null, | ||
| detailWorktreePath: null as string | null, | ||
| projects: new Map<string, { workspaceRoot: string }>(), | ||
| })); | ||
|
|
||
| vi.mock("./entities", () => ({ | ||
| useQuietThreadShell: (ref: unknown) => (ref === null ? null : state.shell), | ||
| useProject: (ref: { projectId: string } | null) => | ||
| ref === null ? null : (state.projects.get(ref.projectId) ?? null), | ||
| })); | ||
| vi.mock("./threads", async () => { | ||
| const { some, none } = await import("effect/Option"); | ||
| return { | ||
| useEnvironmentThread: (environmentId: unknown, threadId: unknown) => ({ | ||
| data: | ||
| environmentId !== null && threadId !== null && state.detail ? some(state.detail) : none(), | ||
| }), | ||
| }; | ||
| }); | ||
| vi.mock("./use-thread-detail", () => ({ | ||
| useThreadWorktreePath: (ref: unknown) => (ref === null ? null : state.detailWorktreePath), | ||
| useSelectedThreadWorktreePath: () => null, | ||
| })); | ||
| vi.mock("./use-thread-selection", () => ({ useThreadSelection: () => ({}) })); | ||
|
|
||
| const { useThreadCwd } = await import("./use-selected-thread-worktree"); | ||
|
|
||
| const ref = { environmentId: EnvironmentId.make("env"), threadId: ThreadId.make("thread") }; | ||
|
|
||
| function setup(input: Partial<Omit<typeof state, "projects">>) { | ||
| Object.assign(state, { shell: null, detail: null, detailWorktreePath: null }, input); | ||
| state.projects = new Map([[ProjectId.make("project"), { workspaceRoot: "/repo" }]]); | ||
| } | ||
|
|
||
| describe("useThreadCwd", () => { | ||
| it("falls back to the project root from the loaded detail when the shell is missing", () => { | ||
| setup({ detail: { thread: { projectId: "project" } } }); | ||
| expect(useThreadCwd(ref)).toBe("/repo"); | ||
| }); | ||
|
|
||
| it("prefers the thread worktree over the project root", () => { | ||
| setup({ shell: { projectId: "project", worktreePath: "/repo/.worktrees/a" } }); | ||
| expect(useThreadCwd(ref)).toBe("/repo/.worktrees/a"); | ||
| }); | ||
|
|
||
| it("is null without a thread", () => { | ||
| setup({ detail: { thread: { projectId: "project" } } }); | ||
| expect(useThreadCwd(null)).toBeNull(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.