Skip to content

Commit 1825ed4

Browse files
fix(mobile): pull request link actions work before detail loads
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1d0c516 commit 1825ed4

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -421,24 +421,24 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
421421
},
422422
]
423423
: []),
424-
...(pr
424+
...(identity
425425
? [
426426
{
427-
accessibilityLabel: openOnProviderLabel(pr.provider),
427+
accessibilityLabel: openOnProviderLabel(identity.provider),
428428
icon: "arrow.up.right" as const,
429-
onPress: () => void Linking.openURL(pr.url),
429+
onPress: () => void Linking.openURL(identity.url),
430430
},
431431
{
432432
accessibilityLabel: "Copy link",
433433
icon: "link" as const,
434434
overflowOnly: true,
435-
onPress: () => copyPullRequestLink(pr),
435+
onPress: () => copyPullRequestLink(identity),
436436
},
437437
{
438438
accessibilityLabel: "Share…",
439439
icon: "square.and.arrow.up" as const,
440440
overflowOnly: true,
441-
onPress: () => sharePullRequestLink(pr),
441+
onPress: () => sharePullRequestLink(identity),
442442
},
443443
]
444444
: []),
@@ -483,23 +483,23 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
483483
<Toolbar.Label>Add comment</Toolbar.Label>
484484
</Toolbar.MenuAction>
485485
) : null}
486-
{pr ? (
486+
{identity ? (
487487
<Toolbar.MenuAction
488488
icon="arrow.up.right"
489-
onPress={() => void Linking.openURL(pr.url)}
489+
onPress={() => void Linking.openURL(identity.url)}
490490
>
491-
<Toolbar.Label>{openOnProviderLabel(pr.provider)}</Toolbar.Label>
491+
<Toolbar.Label>{openOnProviderLabel(identity.provider)}</Toolbar.Label>
492492
</Toolbar.MenuAction>
493493
) : null}
494-
{pr ? (
495-
<Toolbar.MenuAction icon="link" onPress={() => copyPullRequestLink(pr)}>
494+
{identity ? (
495+
<Toolbar.MenuAction icon="link" onPress={() => copyPullRequestLink(identity)}>
496496
<Toolbar.Label>Copy link</Toolbar.Label>
497497
</Toolbar.MenuAction>
498498
) : null}
499-
{pr ? (
499+
{identity ? (
500500
<Toolbar.MenuAction
501501
icon="square.and.arrow.up"
502-
onPress={() => sharePullRequestLink(pr)}
502+
onPress={() => sharePullRequestLink(identity)}
503503
>
504504
<Toolbar.Label>Share…</Toolbar.Label>
505505
</Toolbar.MenuAction>

‎apps/mobile/src/features/pull-requests/pullRequestLink.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function copyPullRequestLink(pr: PullRequestLink) {
1212

1313
export function sharePullRequestLink(pr: PullRequestLink) {
1414
// Android ignores `url`; iOS turns a `message` URL into plain text instead of a link preview.
15-
void Share.share(
15+
Share.share(
1616
Platform.OS === "ios" ? { url: pr.url, title: pr.title } : { message: pr.url, title: pr.title },
17-
);
17+
).catch((cause: unknown) => console.error("Failed to share pull request link.", cause));
1818
}

0 commit comments

Comments
 (0)