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 — Merge remote-tracking branch 'origin/main' into fix/issue-23948 · pingdotgg/t3code@72af7df

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps
    • mobile/src
      • features
        • diffs
          • nativeReviewDiffSource.test.ts
          • nativeReviewDiffSource.ts
        • home
          • thread-swipe-actions.tsx
        • layout
          • AdaptiveWorkspaceLayout.tsx
        • pull-requests
          • PullRequestRouteScreen.tsx
          • pullRequestDiffHighlightFiles.test.ts
          • pullRequestDiffPages.test.ts
          • pullRequestDiffPages.ts
          • usePullRequestDiff.test.tsx
          • usePullRequestDiff.ts
        • threads
          • ThreadDetailScreen.tsx
        • workspace
          • useSelectWorkspaceDetail.ts
          • workspace-selection-store.ts
          • workspace-tab-navigation.test.ts
          • workspace-tab-navigation.ts
      • persistence
        • mobile-preferences.ts
      • state
        • threads.ts
    • server/src/pullRequest
      • PullRequestService.test.ts
      • PullRequestService.ts
  • packages
    • source-control-core/src/server
      • PullRequestProvider.ts
    • source-control-gitcafe/src/server
      • GitCafePullRequestProvider.test.ts
      • GitCafePullRequestProvider.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/mobile/src/features/diffs/nativeReviewDiffSource.test.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/src/features/diffs/nativeReviewDiffSource.test.ts
+18-11Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,24 @@ const failureKeys = [
5858
["function", () => () => SOURCE],
5959
] as const;
6060

61-
it.each(failureKeys)("bounds transient retries for a %s key", async (_name, createKey) => {
62-
const key = createKey();
63-
const fetch = vi.fn(async () => {
64-
throw new Error("Offline");
65-
});
66-
const load = createNativeReviewDiffSourceLoader(fetch);
67-
await expect(load(key)).rejects.toThrow("Offline");
68-
expect(await load(key)).toBeNull();
69-
expect(await load(key)).toBeNull();
70-
expect(fetch).toHaveBeenCalledTimes(2);
71-
});
61+
it.each(failureKeys)(
62+
"recovers after two transient failures on a later load for a %s key",
63+
async (_name, createKey) => {
64+
const key = createKey();
65+
const fetch = vi
66+
.fn()
67+
.mockRejectedValueOnce(new Error("Offline"))
68+
.mockRejectedValueOnce(new Error("Still offline"))
69+
.mockResolvedValue(SOURCE);
70+
const load = createNativeReviewDiffSourceLoader(fetch);
71+
await expect(load(key)).rejects.toThrow("Offline");
72+
await expect(load(key)).rejects.toThrow("Still offline");
73+
expect(fetch).toHaveBeenCalledTimes(2);
74+
expect(await load(key)).toBe(SOURCE);
75+
expect(await load(key)).toBe(SOURCE);
76+
expect(fetch).toHaveBeenCalledTimes(3);
77+
},
78+
);
7279

7380
it.each(failureKeys)(
7481
"remembers permanent unavailability for a %s key",
Collapse file

‎apps/mobile/src/features/diffs/nativeReviewDiffSource.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/src/features/diffs/nativeReviewDiffSource.ts
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const MAX_SOURCE_FILES = 4;
55
// Bound retained UTF-16 text across files without discarding an already-fetched
66
// authoritative source just because it is large. Provider response limits still apply.
77
const MAX_CACHED_SOURCE_CHARACTERS = 8_000_000;
8-
const MAX_SOURCE_ATTEMPTS = 2;
98

109
function isWeakKey(value: unknown): value is object {
1110
return (typeof value === "object" && value !== null) || typeof value === "function";
@@ -158,12 +157,12 @@ export function createNativeReviewDiffSourceLoader<FileId>(
158157
permanent,
159158
reason: reason ?? "transient",
160159
});
161-
if (permanent || attempt >= MAX_SOURCE_ATTEMPTS) {
160+
if (permanent) {
162161
failure.unavailable = true;
163162
traceDiffHighlight("source-unavailable", {
164163
loader,
165164
file,
166-
reason: permanent ? "permanent-error" : "attempts",
165+
reason: "permanent-error",
167166
});
168167
return null;
169168
}
Collapse file

‎apps/mobile/src/features/home/thread-swipe-actions.tsx‎

Copy file name to clipboardExpand all lines: apps/mobile/src/features/home/thread-swipe-actions.tsx
+77-40Lines changed: 77 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ function resolveSecondaryAction(input: {
121121

122122
/** Keep the scroll gate in context so scroll start cannot re-render every row and its subscriptions. */
123123
const SwipeableScrollGateContext = createContext(true);
124+
// Swipeable rebuilds its native pan gesture whenever its config changes identity, so the props
125+
// that feed it stay stable across row re-renders such as selection.
126+
const FAIL_OFFSET_Y: [number, number] = [-10, 10];
124127

125128
export function SwipeableScrollGateProvider(props: {
126129
readonly enabled: boolean;
@@ -402,11 +405,77 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
402405
},
403406
[content],
404407
);
405-
const handleWillOpen = () => {
406-
if (!props.dormant && !dismissalRef.current && swipeableRef.current) {
407-
props.onSwipeableWillOpen?.(swipeableRef.current);
408+
const { dormant, onSwipeableWillOpen, backgroundColor, containerStyle } = props;
409+
const handleWillOpen = useCallback(() => {
410+
if (!dormant && !dismissalRef.current && swipeableRef.current) {
411+
onSwipeableWillOpen?.(swipeableRef.current);
408412
}
413+
}, [dormant, onSwipeableWillOpen]);
414+
const handleSwipeableClose = useCallback(() => {
415+
if (swipeableRef.current) onSwipeableClose?.(swipeableRef.current);
416+
}, [onSwipeableClose]);
417+
const compactActions = props.compactActions === true;
418+
const { secondaryAction, threadTitle } = props;
419+
// Swipeable calls this on every render; returning the previous element while nothing it shows
420+
// changed keeps a selection change from re-rendering the hidden actions.
421+
const rightActions = useRef<{ deps: readonly unknown[]; element: ReactNode } | null>(null);
422+
const renderRightActions = (
423+
_progress: SharedValue<number>,
424+
translation: SharedValue<number>,
425+
methods: SwipeableMethods,
426+
) => {
427+
const deps = [
428+
dormant,
429+
translation,
430+
methods,
431+
actionStyle,
432+
backgroundColor,
433+
compactActions,
434+
fullSwipeAction,
435+
fullSwipeThreshold,
436+
handleFullSwipeArmedChange,
437+
primaryAction,
438+
commitPrimaryAction,
439+
onDelete,
440+
secondaryAction,
441+
threadTitle,
442+
];
443+
const cached = rightActions.current;
444+
if (cached && deps.every((dep, index) => Object.is(dep, cached.deps[index]))) {
445+
return cached.element;
446+
}
447+
const element = dormant ? null : (
448+
<Animated.View
449+
ref={() => {
450+
activeTranslationRef.current = translation;
451+
}}
452+
style={actionStyle}
453+
>
454+
<ThreadSwipeActions
455+
backgroundColor={backgroundColor}
456+
compact={compactActions}
457+
fullSwipeAction={fullSwipeAction}
458+
fullSwipeThreshold={fullSwipeThreshold}
459+
onFullSwipeArmedChange={handleFullSwipeArmedChange}
460+
primaryAction={{ ...primaryAction, onPress: commitPrimaryAction }}
461+
secondaryAction={resolveSecondaryAction({
462+
close: () => methods.close(),
463+
onDelete,
464+
secondaryAction,
465+
threadTitle,
466+
})}
467+
translation={translation}
468+
/>
469+
</Animated.View>
470+
);
471+
rightActions.current = { deps, element };
472+
return element;
409473
};
474+
const childrenContainerStyle = useMemo(() => ({ backgroundColor }), [backgroundColor]);
475+
const swipeableContainerStyle = useMemo(
476+
() => [{ backgroundColor }, containerStyle],
477+
[backgroundColor, containerStyle],
478+
);
410479

411480
return (
412481
<Animated.View style={dismissStyle}>
@@ -419,53 +488,21 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
419488
<ReanimatedSwipeable
420489
ref={swipeableRef}
421490
animationOptions={THREAD_SWIPE_SPRING}
422-
childrenContainerStyle={{ backgroundColor: props.backgroundColor }}
423-
containerStyle={[{ backgroundColor: props.backgroundColor }, props.containerStyle]}
491+
childrenContainerStyle={childrenContainerStyle}
492+
containerStyle={swipeableContainerStyle}
424493
dragOffsetFromRight={-8}
425494
enabled={!props.dormant && !isDismissing && props.enabled !== false && gateEnabled}
426495
enableTrackpadTwoFingerGesture={props.enableTrackpadSwipe ?? true}
427496
// Reject vertical pans via patched RNGH failOffsetY; simultaneous trackpad scrolls otherwise open rows on horizontal drift.
428-
failOffsetY={[-10, 10]}
497+
failOffsetY={FAIL_OFFSET_Y}
429498
friction={1}
430-
onSwipeableClose={() => {
431-
if (swipeableRef.current) {
432-
props.onSwipeableClose?.(swipeableRef.current);
433-
}
434-
}}
499+
onSwipeableClose={handleSwipeableClose}
435500
onSwipeableRelease={handleRelease}
436501
onSwipeableOpenStartDrag={handleWillOpen}
437502
onSwipeableWillOpen={handleWillOpen}
438503
overshootFriction={1}
439504
overshootRight
440-
renderRightActions={(_progress, translation, methods) =>
441-
props.dormant ? null : (
442-
<Animated.View
443-
ref={() => {
444-
activeTranslationRef.current = translation;
445-
}}
446-
style={actionStyle}
447-
>
448-
<ThreadSwipeActions
449-
backgroundColor={props.backgroundColor}
450-
compact={props.compactActions === true}
451-
fullSwipeAction={fullSwipeAction}
452-
fullSwipeThreshold={fullSwipeThreshold}
453-
onFullSwipeArmedChange={handleFullSwipeArmedChange}
454-
primaryAction={{
455-
...primaryAction,
456-
onPress: commitPrimaryAction,
457-
}}
458-
secondaryAction={resolveSecondaryAction({
459-
close: () => methods.close(),
460-
onDelete: props.onDelete,
461-
secondaryAction: props.secondaryAction,
462-
threadTitle: props.threadTitle,
463-
})}
464-
translation={translation}
465-
/>
466-
</Animated.View>
467-
)
468-
}
505+
renderRightActions={renderRightActions}
469506
rightThreshold={actionsWidth * 0.42}
470507
simultaneousWith={props.simultaneousWith}
471508
>
Collapse file

‎apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx‎

Copy file name to clipboardExpand all lines: apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import {
6666
type WorkspaceDetail,
6767
type WorkspaceDetailSheet,
6868
} from "../workspace/workspace-detail-selection";
69+
import { startOpeningDetail } from "../workspace/useSelectWorkspaceDetail";
6970
import { useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
7071
import { HomeListOptionsProvider } from "../home/home-list-options";
7172
import { newTaskDestination } from "../threads/new-task-project-selection";
@@ -498,6 +499,7 @@ function AdaptiveWorkspaceLayoutContent(
498499
type: "select",
499500
tab: detail.name === "Thread" ? "threads" : "pullRequests",
500501
});
502+
startOpeningDetail(detail);
501503
navigation.dispatch(selectWorkspaceDetail(detail, sheet));
502504
});
503505
}
Collapse file

‎apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx‎

Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+27-6Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {
4343
import { usePullRequestDiffHighlightFiles } from "./usePullRequestDiffHighlightFiles";
4444
import { isPullRequestTestFile } from "./pullRequestFileFilters";
4545
import { useFocusEffect, useNavigation, type StaticScreenProps } from "@react-navigation/native";
46+
import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
4647
import { RegistryContext, useAtomRefresh, useAtomValue } from "@effect/atom-react";
4748
import { pullRequestReviewKey } from "./pullRequestReviewDrafts";
4849
import { type PullRequestDetail, type PullRequestListEntry } from "@t3tools/contracts";
@@ -88,7 +89,7 @@ import {
8889
type NativeReviewDiffViewProps,
8990
} from "../diffs/nativeReviewDiffSurface";
9091
import {
91-
buildNativeReviewDiffData,
92+
getCachedNativeReviewDiffData,
9293
NATIVE_REVIEW_DIFF_CONTENT_WIDTH,
9394
} from "../review/nativeReviewDiffAdapter";
9495
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
@@ -99,6 +100,7 @@ import { PullRequestActionToolbar, PullRequestCardGroup } from "./PullRequestCon
99100
import {
100101
pullRequestTarget as requestTarget,
101102
usePullRequestDiff,
103+
usePullRequestDiffEntry,
102104
type PullRequestDiffParams,
103105
type PullRequestParams,
104106
} from "./usePullRequestDiff";
@@ -847,16 +849,35 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
847849
);
848850
}
849851

850-
export function PullRequestFileRouteScreen({
851-
route,
852-
}: StaticScreenProps<
852+
type PullRequestFileRouteProps = StaticScreenProps<
853853
PullRequestDiffParams & {
854854
readonly path: string;
855855
readonly fileSelectionId?: string;
856856
readonly replacingDraftId?: string;
857857
readonly focus?: GuideDiffFocus;
858858
}
859-
>) {
859+
>;
860+
861+
export function PullRequestFileRouteScreen(props: PullRequestFileRouteProps) {
862+
const navigation =
863+
useNavigation<NativeStackNavigationProp<ReactNavigation.RootParamList, "PullRequestFile">>();
864+
const ready = usePullRequestDiffEntry(navigation);
865+
if (ready) return <PullRequestFileRouteContent {...props} />;
866+
const title = props.route.params.commit ? "Commit changes" : "Changes";
867+
return (
868+
<View className="flex-1 bg-screen">
869+
<NativeStackScreenOptions options={{ title, headerTitle: title }} />
870+
{Platform.OS === "android" ? (
871+
<AndroidScreenHeader title={title} onBack={() => navigation.goBack()} />
872+
) : null}
873+
<View className="flex-1 items-center justify-center">
874+
<AppActivityIndicator accessibilityLabel="Loading changes" />
875+
</View>
876+
</View>
877+
);
878+
}
879+
880+
function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
860881
const { layout } = useAdaptiveWorkspaceLayout();
861882
const navigation = useNavigation();
862883
const insets = useSafeAreaInsets();
@@ -894,7 +915,7 @@ export function PullRequestFileRouteScreen({
894915
!result.isPending &&
895916
!result.error;
896917
const activity = useEnvironmentQuery(composerPullRequests.activity(requestTarget(route.params)));
897-
const baseData = useMemo(() => buildNativeReviewDiffData(parsed), [parsed]);
918+
const baseData = useMemo(() => getCachedNativeReviewDiffData({ parsedDiff: parsed }), [parsed]);
898919
const highlightFiles = usePullRequestDiffHighlightFiles(route.params, parsed, baseData.files);
899920
const data = useMemo(
900921
() =>
Collapse file

‎apps/mobile/src/features/pull-requests/pullRequestDiffHighlightFiles.test.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/pullRequestDiffHighlightFiles.test.ts
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,12 @@ it.each(["permanent", "transient"])(
265265
fetch.mockRejectedValueOnce(error);
266266
if (failure === "transient") fetch.mockRejectedValueOnce(error);
267267
const first = createPullRequestDiffHighlightFiles({ target }, parsed, files, fetch, cache);
268-
if (failure === "transient") await expect(first[1]!.loadContents!()).rejects.toThrow("Offline");
269-
expect(await first[1]!.loadContents!()).toBeNull();
268+
if (failure === "transient") {
269+
await expect(first[1]!.loadContents!()).rejects.toThrow("Offline");
270+
await expect(first[1]!.loadContents!()).rejects.toThrow("Offline");
271+
} else {
272+
expect(await first[1]!.loadContents!()).toBeNull();
273+
}
270274
const second = createPullRequestDiffHighlightFiles(
271275
{ target },
272276
{ ...parsed, files: [parsed.files[0]!, { ...parsed.files[1]! }] },
@@ -275,8 +279,8 @@ it.each(["permanent", "transient"])(
275279
cache,
276280
);
277281
expect(await second[1]!.loadContents!()).toBe(contents);
278-
expect(await first[1]!.loadContents!()).toBeNull();
279-
expect(fetch).toHaveBeenCalledTimes(failure === "permanent" ? 2 : 3);
282+
expect(await first[1]!.loadContents!()).toBe(failure === "permanent" ? null : contents);
283+
expect(fetch).toHaveBeenCalledTimes(failure === "permanent" ? 2 : 4);
280284
},
281285
);
282286

0 commit comments

Comments
0 (0)
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.