Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions apps/dashboard/src/components/pulls/review/review-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,11 @@ export function ReviewPage() {
// Stable store for active file — updates bypass ReviewPage renders entirely
const activeFileStore = useRef(createActiveFileStore(null)).current;

const pageQuery = useQuery({
...githubPullPageQueryOptions(scope, input),
refetchOnMount: false,
refetchOnWindowFocus: false,
});
const pageQuery = useQuery(githubPullPageQueryOptions(scope, input));

const fileSummariesQuery = useInfiniteQuery({
...githubPullFileSummariesQueryOptions(scope, input),
refetchOnMount: false,
refetchOnWindowFocus: false,
});
const fileSummariesQuery = useInfiniteQuery(
githubPullFileSummariesQueryOptions(scope, input),
);

// Auto-fetch remaining pages so the sidebar streams in the whole tree
// without requiring user interaction. Each page is ~100 files, so for a
Expand All @@ -167,11 +161,9 @@ export function ReviewPage() {
fileSummariesQuery.fetchNextPage,
]);

const filesQuery = useInfiniteQuery({
...githubPullFilesInfiniteQueryOptions(scope, input),
refetchOnMount: false,
refetchOnWindowFocus: false,
});
const filesQuery = useInfiniteQuery(
githubPullFilesInfiniteQueryOptions(scope, input),
);

// Auto-fetch remaining pages of patches in the background so that by the
// time the user scrolls deeper into the PR, the data is already there.
Expand All @@ -188,14 +180,12 @@ export function ReviewPage() {
]);

const hasDiffPayload = filesQuery.data !== undefined;
const reviewCommentsQuery = useQuery({
...githubPullReviewCommentsQueryOptions(scope, input),
refetchOnWindowFocus: false,
});
const threadStatusesQuery = useQuery({
...githubReviewThreadStatusesQueryOptions(scope, input),
refetchOnWindowFocus: false,
});
const reviewCommentsQuery = useQuery(
githubPullReviewCommentsQueryOptions(scope, input),
);
const threadStatusesQuery = useQuery(
githubReviewThreadStatusesQueryOptions(scope, input),
);
useGitHubSignalStream(webhookRefreshTargets);

const pr = pageQuery.data?.detail ?? null;
Expand Down
8 changes: 3 additions & 5 deletions apps/dashboard/src/components/repo/commit-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,9 @@ export function CommitPage() {
const activeFileStore = useRef(createActiveFileStore(null)).current;
const diffPaneRef = useRef<CommitDiffPaneHandle>(null);

const commitQuery = useQuery({
...githubRepoCommitQueryOptions(scope, { owner, repo, sha }),
refetchOnMount: false,
refetchOnWindowFocus: false,
});
const commitQuery = useQuery(
githubRepoCommitQueryOptions(scope, { owner, repo, sha }),
);

const commit = commitQuery.data;

Expand Down
2 changes: 0 additions & 2 deletions apps/dashboard/src/components/repo/latest-commit-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export function LatestCommitBar({
ref === defaultBranch && defaultBranchTip != null
? defaultBranchTip
: undefined,
refetchOnMount: false,
refetchOnWindowFocus: false,
});

const commit = tipQuery.data;
Expand Down
30 changes: 15 additions & 15 deletions apps/dashboard/src/lib/github-cache-policy.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
export const githubCachePolicy = {
viewer: {
staleTimeMs: 30 * 60 * 1000,
staleTimeMs: 5 * 60 * 1000,
gcTimeMs: 24 * 60 * 60 * 1000,
},
reposList: {
staleTimeMs: 10 * 60 * 1000,
staleTimeMs: 2 * 60 * 1000,
gcTimeMs: 12 * 60 * 60 * 1000,
},
list: {
staleTimeMs: 2 * 60 * 1000,
staleTimeMs: 30 * 1000,
gcTimeMs: 60 * 60 * 1000,
},
/** User-scoped "My pulls/issues/reviews" aggregates — shorter TTL + faster webhook alignment */
/** User-scoped "My pulls/issues/reviews" aggregates */
mine: {
staleTimeMs: 30 * 1000,
staleTimeMs: 10 * 1000,
gcTimeMs: 15 * 60 * 1000,
},
detail: {
staleTimeMs: 30 * 1000,
staleTimeMs: 5 * 1000,
gcTimeMs: 10 * 60 * 1000,
},
activity: {
staleTimeMs: 20 * 1000,
staleTimeMs: 5 * 1000,
gcTimeMs: 10 * 60 * 1000,
},
userActivity: {
staleTimeMs: 5 * 60 * 1000,
staleTimeMs: 60 * 1000,
gcTimeMs: 30 * 60 * 1000,
},
status: {
staleTimeMs: 15 * 1000,
staleTimeMs: 5 * 1000,
gcTimeMs: 5 * 60 * 1000,
},
workflowRun: {
staleTimeMs: 15 * 1000,
staleTimeMs: 5 * 1000,
gcTimeMs: 5 * 60 * 1000,
},
contributions: {
staleTimeMs: 60 * 60 * 1000,
staleTimeMs: 15 * 60 * 1000,
gcTimeMs: 24 * 60 * 60 * 1000,
},
repoMeta: {
staleTimeMs: 30 * 60 * 1000,
staleTimeMs: 5 * 60 * 1000,
gcTimeMs: 24 * 60 * 60 * 1000,
},
repoParticipation: {
staleTimeMs: 60 * 60 * 1000,
staleTimeMs: 15 * 60 * 1000,
gcTimeMs: 24 * 60 * 60 * 1000,
},
installationAccess: {
staleTimeMs: 30 * 60 * 1000,
staleTimeMs: 5 * 60 * 1000,
gcTimeMs: 24 * 60 * 60 * 1000,
},
repoProtection: {
staleTimeMs: 30 * 60 * 1000,
staleTimeMs: 5 * 60 * 1000,
gcTimeMs: 24 * 60 * 60 * 1000,
},
} as const;
2 changes: 1 addition & 1 deletion apps/dashboard/src/lib/github-cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ describe("getOrRevalidateGitHubResource", () => {
expect(result).toEqual({ login: "adn" });

const updatedEntry = await store.get("user-1::viewer::null");
expect(updatedEntry?.freshUntil).toBe(300_500);
expect(updatedEntry?.freshUntil).toBe(90_500);
expect(updatedEntry?.rateLimitRemaining).toBe(10);
});

Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/lib/github-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ type GetOrRevalidateGitHubResourceOptions<TData> = {
const DEFAULT_GITHUB_PAYLOAD_RETENTION_SECONDS = 7 * 24 * 60 * 60;
const GITHUB_RATE_LIMIT_LOW_REMAINING = 100;
const GITHUB_RATE_LIMIT_CRITICAL_REMAINING = 25;
const GITHUB_RATE_LIMIT_LOW_FRESH_FLOOR_MS = 2 * 60 * 1000;
const GITHUB_RATE_LIMIT_CRITICAL_FRESH_FLOOR_MS = 5 * 60 * 1000;
const GITHUB_RATE_LIMIT_LOW_FRESH_FLOOR_MS = 45 * 1000;
const GITHUB_RATE_LIMIT_CRITICAL_FRESH_FLOOR_MS = 90 * 1000;
const GITHUB_RATE_LIMIT_RESET_BUFFER_MS = 5 * 1000;
const GITHUB_STALE_IF_RATE_LIMITED_FALLBACK_MS = 60 * 1000;

Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/src/lib/query-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ export function createAppQueryClient() {
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: 1,
networkMode: "online",
},
Expand Down
Loading