GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(mobile): pull request project filter lists each repository once per environment by tris203 · Pull Request #23121 · pingdotgg/t3code

fix(mobile): pull request project filter lists each repository once per environment #23121

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.

Sign up for GitHub

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

Closed
tris203 wants to merge 3 commits into pingdotgg:main from tris203:fix/mobile-pr-filter-duplicate-projects

Uh oh!

There was an error while loading. Please reload this page.

Closed

fix(mobile): pull request project filter lists each repository once per environment #23121

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
2cb0462
fix(mobile): pull request project filter lists each repository once p…
tris203 Oct 21, 2026
fbc868e
fix(mobile): pull request project filter lists only environments that…
tris203 Oct 21, 2026
58be215
fix(mobile): a saved pull request project scope stays visible when it…
tris203 Oct 21, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
fix(mobile): a saved pull request project scope stays visible when it…
…s environment stops serving pull requests
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@tris203
tris203 committed Oct 27, 2026
commit 58be215ce5ad0f7cb79fe11d7dc6fa7490e1dbf5

There are no files selected for viewing

22 changes: 8 additions & 14 deletions 22 apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
import { useWorkspaceState } from "../../state/workspace";
import { useProjects } from "../../state/entities";
import { pullRequestFilterProjects } from "@t3tools/client-runtime/pull-request-project-filter";
import { environmentServerConfigsAtom } from "../../state/server";
import { PullRequestListRow } from "./PullRequestListRow";
import {
Expand All @@ -44,6 +43,7 @@ import {
pullRequestListRowsAreEqual,
scopedPullRequestListKey as pullRequestKey,
type EnvironmentPullRequestListEntry,
pullRequestProjectChoices,
withoutScratchProjectScope,
} from "./pullRequestList";
import { useDebouncedValue } from "../../state/queries";
Expand Down Expand Up @@ -229,20 +229,14 @@ export function PullRequestsScreen(
}
const labelColors =
knownFacets.environmentId === environmentId ? knownFacets.labelColors : facets.labelColors;
const projects = pullRequestFilterProjects(
allProjects.filter(
(project) =>
!project.isScratch &&
configs.get(project.environmentId)?.environment.capabilities.pullRequests === true &&
(environmentId === null || project.environmentId === environmentId),
),
new Map(environments.map((item) => [item.environmentId, item.environmentLabel])),
allProjects.find(
(project) =>
project.id === controls.projectId &&
project.environmentId === controls.projectEnvironmentId,
const projects = pullRequestProjectChoices(allProjects, {
environmentId,
controls,
environmentLabels: new Map(
environments.map((item) => [item.environmentId, item.environmentLabel]),
),
);
servesPullRequests: (id) => configs.get(id)?.environment.capabilities.pullRequests === true,
});
const filters = usePullRequestListFilters({
environments: environments.map((item) => ({
id: String(item.environmentId),
Expand Down
49 changes: 49 additions & 0 deletions 49 apps/mobile/src/features/pull-requests/pullRequestList.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vite-plus/test";
import {
EnvironmentId,
ProjectId,
SourceControlProviderKind,
type PullRequestListEntry,
type PullRequestListResult,
Expand All @@ -22,6 +23,7 @@ import {
scopedPullRequestListKey,
shownPullRequestListPages,
pullRequestListRowsAreEqual,
pullRequestProjectChoices,
withAnsweredPullRequestStats,
withListedPullRequests,
withShownPullRequestStats,
Expand Down Expand Up @@ -472,3 +474,50 @@ describe("cached PR diff stats", () => {
expect(pushed.refresh).toEqual([query]);
});
});

describe("pullRequestProjectChoices", () => {
const laptop = EnvironmentId.make("env-laptop");
const desktop = EnvironmentId.make("env-desktop");
const project = (id: string, environmentId: EnvironmentId) => ({
id: ProjectId.make(id),
environmentId,
title: "t3code",
workspaceRoot: `/work/${id}`,
repositoryIdentity: { canonicalKey: "github.com/pingdotgg/t3code" },
});
const projects = [project("main", laptop), project("worktree", laptop), project("main", desktop)];
const choices = (
servesPullRequests: (environmentId: EnvironmentId) => boolean,
scope: { projectId?: string; projectEnvironmentId?: string } = {},
) =>
pullRequestProjectChoices(projects, {
environmentId: null,
controls: { ...DEFAULT_PR_LIST_CONTROLS, ...scope },
environmentLabels: new Map([
[laptop, "laptop"],
[desktop, "desktop"],
]),
servesPullRequests,
}).map(({ id, environmentId, title }) => ({ id, environmentId, title }));

it("lists each repository once per environment that serves pull requests", () => {
expect(choices(() => true)).toEqual([
{ id: "main", environmentId: desktop, title: "t3code · desktop" },
{ id: "main", environmentId: laptop, title: "t3code · laptop" },
]);
expect(choices((environmentId) => environmentId === desktop)).toEqual([
{ id: "main", environmentId: desktop, title: "t3code" },
]);
});

it("keeps the saved scope when its environment stops serving or has not loaded", () => {
const scope = { projectId: "worktree", projectEnvironmentId: laptop };
expect(choices((environmentId) => environmentId === desktop, scope)).toEqual([
{ id: "main", environmentId: desktop, title: "t3code · desktop" },
{ id: "worktree", environmentId: laptop, title: "t3code · laptop" },
]);
expect(choices(() => false, scope)).toEqual([
{ id: "worktree", environmentId: laptop, title: "t3code" },
]);
});
});
34 changes: 34 additions & 0 deletions 34 apps/mobile/src/features/pull-requests/pullRequestList.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { pullRequestFilterProjects } from "@t3tools/client-runtime/pull-request-project-filter";
import { parsePullRequestQuery } from "@t3tools/client-runtime/pull-request-query";
import {
ProjectId,
Expand Down Expand Up @@ -34,6 +35,39 @@ export function withoutScratchProjectScope(
: controls;
}

type FilterProject = Parameters<typeof pullRequestFilterProjects>[0][number];

/**
* Projects from environments that serve pull requests, as on web. The saved scope stays a choice
* even when its environment stops serving them or its config has not loaded, so the restriction it
* still applies to the list remains visible and can be cleared.
*/
export function pullRequestProjectChoices<
Project extends FilterProject & { readonly isScratch?: true },
>(
projects: readonly Project[],
input: {
readonly environmentId: string | null;
readonly controls: PullRequestListControls;
readonly environmentLabels: ReadonlyMap<EnvironmentId, string>;
readonly servesPullRequests: (environmentId: EnvironmentId) => boolean;
},
) {
const isSelected = (project: Project) =>
project.id === input.controls.projectId &&
project.environmentId === input.controls.projectEnvironmentId;
return pullRequestFilterProjects(
projects.filter(
(project) =>
!project.isScratch &&
(input.environmentId === null || project.environmentId === input.environmentId) &&
(input.servesPullRequests(project.environmentId) || isSelected(project)),
),
input.environmentLabels,
projects.find(isSelected),
);
}

export function pullRequestListKey(
item: Pick<PullRequestListEntry, "host" | "repository" | "number">,
) {
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.