From 6f8318570969eeaa316ad951aa623a201f626fa6 Mon Sep 17 00:00:00 2001 From: Victor Vogel Date: Sat, 24 Oct 2026 08:08:02 -0500 Subject: [PATCH] fix(mobile): opening another stack layer no longer shows the previous pull request The stack card spread the current route's params into the next layer's route, so the list summary of the layer you came from went along. Until the new layer's detail loaded, its header, loading overview and the Open, Copy link and Share actions used the old pull request's summary and URL. Opening a layer now drops that summary. Co-Authored-By: Claude Opus 5.5 --- .../pull-requests/PullRequestStackCard.tsx | 3 ++- .../pull-requests/pullRequestStack.test.ts | 21 +++++++++++++++++++ .../pull-requests/pullRequestStack.ts | 9 ++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/apps/mobile/src/features/pull-requests/PullRequestStackCard.tsx b/apps/mobile/src/features/pull-requests/PullRequestStackCard.tsx index 734be2162a677..3a7bb122a0911 100644 --- a/apps/mobile/src/features/pull-requests/PullRequestStackCard.tsx +++ b/apps/mobile/src/features/pull-requests/PullRequestStackCard.tsx @@ -4,6 +4,7 @@ import { Platform, View } from "react-native"; import { useAndroidWorkspaceSelection } from "../workspace/useAndroidWorkspaceSelection"; import { AppText as Text } from "../../components/ui/AppText"; import { PullRequestCardGroup, PullRequestCardRow } from "./PullRequestControls"; +import { pullRequestLayerParams } from "./pullRequestStack"; import { pullRequestStatus } from "./pullRequestStatus"; import type { PullRequestParams } from "./usePullRequestDiff"; import type { PullRequestStackState } from "./usePullRequestStack"; @@ -66,7 +67,7 @@ export function PullRequestStackCard(props: { selected ? undefined : () => { - const params = { ...props.params, number: layer.number }; + const params = pullRequestLayerParams(props.params, layer.number); if (Platform.OS === "android") selectAndroidWorkspace({ name: "PullRequest", params }); else navigation.dispatch(StackActions.push("PullRequest", params)); diff --git a/apps/mobile/src/features/pull-requests/pullRequestStack.test.ts b/apps/mobile/src/features/pull-requests/pullRequestStack.test.ts index bc91b36a54a60..2a2fc9d87cdca 100644 --- a/apps/mobile/src/features/pull-requests/pullRequestStack.test.ts +++ b/apps/mobile/src/features/pull-requests/pullRequestStack.test.ts @@ -2,6 +2,7 @@ import { sourceControlClients } from "@t3tools/client-runtime/source-control-cli import { ProjectId, type PullRequestStack, type ThreadPullRequestLink } from "@t3tools/contracts"; import { describe, expect, it } from "vite-plus/test"; import { + pullRequestLayerParams, pullRequestStackMerge, savedPullRequestStack, singlePullRequestMergeAllowed, @@ -124,6 +125,26 @@ describe("mobile stack merge scope", () => { }); }); +describe("mobile stack layer navigation", () => { + it("opens another layer without the summary of the layer it came from", () => { + const route = { + environmentId: "environment", + projectId: "project", + repository: "acme/web", + host: "github.com", + number: 2, + initialSummary: { number: 2, url: "https://github.com/acme/web/pull/2" }, + }; + expect(pullRequestLayerParams(route, 3)).toEqual({ + environmentId: "environment", + projectId: "project", + repository: "acme/web", + host: "github.com", + number: 3, + }); + }); +}); + describe("mobile saved stack navigation", () => { it("keeps all saved layers and enriches titles without carrying action revisions", () => { const saved = savedPullRequestStack([link], reference); diff --git a/apps/mobile/src/features/pull-requests/pullRequestStack.ts b/apps/mobile/src/features/pull-requests/pullRequestStack.ts index d6b06e6a4dd73..eb8e3736ec995 100644 --- a/apps/mobile/src/features/pull-requests/pullRequestStack.ts +++ b/apps/mobile/src/features/pull-requests/pullRequestStack.ts @@ -67,6 +67,15 @@ export function savedPullRequestStack( }; } +/** The list summary describes the layer it was opened from, so another layer's route drops it. */ +export function pullRequestLayerParams( + params: Params, + number: number, +) { + const { initialSummary: _, ...layer } = params; + return { ...layer, number }; +} + export function singlePullRequestMergeAllowed(input: { readonly supportsStackActions: boolean; readonly hasStack: boolean;