Repository navigation
perf: show PR list rows before their checks, and open PRs faster #9384
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
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8ab33fa
perf(host-service): let PR list callers fetch row checks after the se…
AviPeltz ceba000
perf(shared): ask for requested reviewers alongside the PR detail read
AviPeltz 9c24799
perf(desktop): show PR rows before their checks and open PRs faster
AviPeltz 217f214
Merge remote-tracking branch 'origin/main' into speed-up-pr-view-7ba8…
AviPeltz 1c5bbc8
fix(desktop): address review on the PR view speedups
AviPeltz 1b48c58
fix(desktop): harden deferred PR row details after review
AviPeltz daf0ebb
fix(desktop): prefetch the row the pointer settles on, not only the f…
AviPeltz 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
65 changes: 65 additions & 0 deletions
65
...ullRequestDetailSkeleton/components/PullRequestPreviewHeader/PullRequestPreviewHeader.tsx
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,65 @@ | ||
| import { Avatar, AvatarFallback, AvatarImage } from "@superset/ui/avatar"; | ||
| import type { PullRequestPreview } from "../../../../hooks/usePullRequestListPreview"; | ||
| import { PullRequestStatePill } from "../../../PullRequestStatePill"; | ||
|
|
||
| /** PullRequestItemHeader's first lines, drawn from the list row before the detail arrives. */ | ||
| export function PullRequestPreviewHeader({ | ||
| preview, | ||
| }: { | ||
| preview: PullRequestPreview; | ||
| }) { | ||
| const repositoryName = | ||
| preview.repoFullName.split("/").pop() ?? preview.repoFullName; | ||
| return ( | ||
| <header className="shrink-0 pb-4"> | ||
| <div className="flex min-w-0 items-center gap-2"> | ||
| <PullRequestStatePill | ||
| data={{ | ||
| state: preview.state, | ||
| isDraft: preview.isDraft, | ||
| mergeability: "unknown", | ||
| }} | ||
| /> | ||
| <span | ||
| className="min-w-0 truncate text-xs text-muted-foreground" | ||
| title={preview.repoFullName} | ||
| > | ||
| {repositoryName} #{preview.number} | ||
| </span> | ||
| </div> | ||
| <h1 className="mt-3 select-text break-words text-[1.75rem] font-semibold leading-tight tracking-tight @max-[48rem]/detail:text-2xl @max-[36rem]/detail:mt-2 @max-[36rem]/detail:text-xl"> | ||
| {preview.title} | ||
| </h1> | ||
| <div className="mt-3 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground"> | ||
| {preview.authorLogin ? ( | ||
| <span | ||
| className="flex min-w-0 items-center gap-1.5 font-medium text-foreground" | ||
| title={preview.authorLogin} | ||
| > | ||
| <Avatar className="size-4 rounded-full ring-1 ring-border/50"> | ||
| <AvatarImage | ||
| src={`https://github.com/${preview.authorLogin}.png?size=64`} | ||
| alt="" | ||
| /> | ||
| <AvatarFallback className="text-[8px]"> | ||
| {preview.authorLogin.slice(0, 1).toUpperCase()} | ||
| </AvatarFallback> | ||
| </Avatar> | ||
| <span className="truncate">{preview.authorLogin}</span> | ||
| </span> | ||
| ) : null} | ||
| {preview.headRef ? ( | ||
| <> | ||
| <span aria-hidden>·</span> | ||
| <span | ||
| className="min-w-0 truncate text-[11px] text-muted-foreground/80" | ||
| title={preview.headRef} | ||
| > | ||
| {preview.headRef} | ||
| </span> | ||
| </> | ||
| ) : null} | ||
| </div> | ||
| </header> | ||
| ); | ||
| } |
1 change: 1 addition & 0 deletions
1
...equests/components/PullRequestDetailSkeleton/components/PullRequestPreviewHeader/index.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 @@ | ||
| export { PullRequestPreviewHeader } from "./PullRequestPreviewHeader"; |
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
66 changes: 66 additions & 0 deletions
66
...s/components/PullRequestItemHeader/components/PullRequestCopyText/PullRequestCopyText.tsx
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,66 @@ | ||
| import { useLingui } from "@lingui/react/macro"; | ||
| import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip"; | ||
| import { cn } from "@superset/ui/utils"; | ||
| import { type ReactNode, useState } from "react"; | ||
| import { useCopyToClipboard } from "renderer/hooks/useCopyToClipboard"; | ||
|
|
||
| const FEEDBACK_MS = 1500; | ||
|
|
||
| interface PullRequestCopyTextProps { | ||
| /** What lands on the clipboard; also shown in full in the tooltip, since the text may be truncated. */ | ||
| value: string; | ||
| /** The action, under the value in the tooltip. */ | ||
| label: string; | ||
| children: ReactNode; | ||
| className?: string; | ||
| } | ||
|
|
||
| /** Header text that copies on click and says so. */ | ||
| export function PullRequestCopyText({ | ||
| value, | ||
| label, | ||
| children, | ||
| className, | ||
| }: PullRequestCopyTextProps) { | ||
| const { t } = useLingui(); | ||
| const { copyToClipboard, copied } = useCopyToClipboard(FEEDBACK_MS); | ||
| const [failed, setFailed] = useState(false); | ||
| const copy = () => { | ||
| setFailed(false); | ||
| copyToClipboard(value).catch((error: unknown) => { | ||
| console.warn("[PullRequestCopyText] copy failed", error); | ||
| setFailed(true); | ||
| setTimeout(() => setFailed(false), FEEDBACK_MS); | ||
| }); | ||
| }; | ||
| return ( | ||
| <Tooltip open={copied || failed ? true : undefined}> | ||
| <TooltipTrigger asChild> | ||
| <button | ||
| type="button" | ||
| onClick={copy} | ||
| className={cn( | ||
| "-mx-1 min-w-0 cursor-pointer rounded px-1 text-left transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", | ||
| className, | ||
| )} | ||
| > | ||
| {children} | ||
| </button> | ||
| </TooltipTrigger> | ||
| <TooltipContent side="bottom" className="max-w-sm"> | ||
| {failed ? ( | ||
| t({ message: "Copy failed" }) | ||
| ) : copied ? ( | ||
| t({ message: "Copied" }) | ||
| ) : value === label ? ( | ||
| label | ||
| ) : ( | ||
| <span className="flex flex-col gap-0.5"> | ||
| <span className="break-all font-medium">{value}</span> | ||
| <span className="opacity-70">{label}</span> | ||
| </span> | ||
| )} | ||
| </TooltipContent> | ||
| </Tooltip> | ||
| ); | ||
| } |
1 change: 1 addition & 0 deletions
1
...rd/pull-requests/components/PullRequestItemHeader/components/PullRequestCopyText/index.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 @@ | ||
| export { PullRequestCopyText } from "./PullRequestCopyText"; |
Oops, something went wrong.
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.