Skip to content
Open
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
4 changes: 4 additions & 0 deletions apps/app/.ladle/story-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ export function makeThreadListEntry(
environmentName: null,
environmentBranchName: null,
environmentWorkspaceDisplayKind: "other",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 100 },
pullRequest: { state: "not_applicable", refreshedAt: 100 },
},
runtime: { displayStatus: "idle", hostReconnectGraceExpiresAt: null },
};
return { ...base, ...overrides };
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/components/sidebar/ProjectList.modes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ function makeThread(overrides: Partial<ThreadListEntry> = {}): ThreadListEntry {
activeGoalCount: 0,
},
hasPendingInteraction: false,
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
environmentHostId: null,
environmentName: null,
environmentBranchName: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ function makeThread(overrides: Partial<ThreadListEntry> = {}): ThreadListEntry {
environmentName: null,
environmentBranchName: null,
environmentWorkspaceDisplayKind: "other",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 100 },
pullRequest: { state: "not_applicable", refreshedAt: 100 },
},
runtime: { displayStatus: "idle", hostReconnectGraceExpiresAt: null },
...overrides,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ function createThreadListEntry({
environmentId: null,
environmentName: null,
environmentWorkspaceDisplayKind: "other",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1000 },
pullRequest: { state: "not_applicable", refreshedAt: 1000 },
},
hasPendingInteraction: false,
id,
lastReadAt: null,
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/components/sidebar/ThreadRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ function createThread(
environmentName: null,
environmentBranchName: null,
environmentWorkspaceDisplayKind: "other",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
runtime: {
displayStatus: "idle",
hostReconnectGraceExpiresAt: null,
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/components/sidebar/machineThreadGroups.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ function createThread(overrides: Partial<ThreadListEntry>): ThreadListEntry {
activeGoalCount: 0,
},
hasPendingInteraction: false,
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
environmentHostId: null,
environmentName: null,
environmentBranchName: null,
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/components/sidebar/pinnedSidebarThreads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ function createThread(
environmentName: null,
environmentBranchName: null,
environmentWorkspaceDisplayKind: "other",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 2 },
pullRequest: { state: "not_applicable", refreshedAt: 2 },
},
runtime: {
displayStatus: "idle",
hostReconnectGraceExpiresAt: null,
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/components/sidebar/projectThreadGroups.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ function createThread(
environmentName: null,
environmentBranchName: null,
environmentWorkspaceDisplayKind: "other",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 2 },
pullRequest: { state: "not_applicable", refreshedAt: 2 },
},
runtime: {
displayStatus: "idle",
hostReconnectGraceExpiresAt: null,
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/components/sidebar/sortComparator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ function thread(overrides: Partial<ThreadListEntry>): ThreadListEntry {
environmentName: null,
environmentBranchName: null,
environmentWorkspaceDisplayKind: "other",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 2 },
pullRequest: { state: "not_applicable", refreshedAt: 2 },
},
runtime: {
displayStatus: "idle",
hostReconnectGraceExpiresAt: null,
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/components/sidebar/useSectionThreadDnd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ function createThread(overrides: Partial<ThreadListEntry>): ThreadListEntry {
activeGoalCount: 0,
},
hasPendingInteraction: false,
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
environmentHostId: null,
environmentName: null,
environmentBranchName: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ function threadListEntry(
activeGoalCount: 0,
},
hasPendingInteraction: false,
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
environmentHostId: null,
environmentName: null,
environmentBranchName: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ function threadListEntry(
},
pinSortKey: null,
hasPendingInteraction: false,
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
environmentHostId: "host_toc",
environmentName: "ToC environment",
environmentBranchName: "main",
Expand Down
4 changes: 4 additions & 0 deletions apps/app/src/components/ui/markdown-thread-mentions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ function threadResponse(
hostReconnectGraceExpiresAt: null,
},
canSpawnChild: true,
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
...overrides,
};
}
Expand Down
2 changes: 0 additions & 2 deletions apps/app/src/hooks/cache-owners/cache-owner-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ const CACHE_OWNER_QUERY_KEY_IMPORTS: CacheOwnerQueryKeyImportRegistry = {
"environmentDiffPatchQueryKeyPrefix",
"environmentFilePreviewQueryKeyPrefix",
"environmentMergeBaseBranchesQueryKeyPrefix",
"environmentPullRequestQueryKey",
"environmentQueryKey",
"environmentWorkStatusQueryKey",
"environmentWorkStatusQueryKeyPrefix",
Expand All @@ -160,7 +159,6 @@ const CACHE_OWNER_QUERY_KEY_IMPORTS: CacheOwnerQueryKeyImportRegistry = {
"allTerminalsQueryKeyPrefix",
"environmentDiffFilesQueryKeyPrefix",
"environmentFilePreviewQueryKeyPrefix",
"environmentPullRequestQueryKey",
"environmentWorkStatusQueryKeyPrefix",
"hostsQueryKey",
"sidebarNavigationQueryKey",
Expand Down
11 changes: 8 additions & 3 deletions apps/app/src/hooks/cache-owners/query-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
environmentDiffPatchQueryKeyPrefix,
environmentFilePreviewQueryKeyPrefix,
environmentMergeBaseBranchesQueryKeyPrefix,
environmentPullRequestQueryKey,
environmentQueryKey,
environmentWorkStatusQueryKey,
environmentWorkStatusQueryKeyPrefix,
Expand Down Expand Up @@ -369,7 +368,6 @@ export function getEnvironmentWorkspaceStateInvalidationQueryKeys({
}: EnvironmentInvalidationParams): QueryKey[] {
return [
environmentWorkStatusQueryKeyPrefix(environmentId),
environmentPullRequestQueryKey(environmentId),
environmentDiffFilesQueryKeyPrefix(environmentId),
environmentFilePreviewQueryKeyPrefix(environmentId),
];
Expand Down Expand Up @@ -462,7 +460,7 @@ export function getEnvironmentActionInvalidationQueryKeys({
export function getCachedThreadListPlaceholder(
queryClient: QueryClient,
threadId: string,
): ThreadWithRuntime | undefined {
): ThreadListEntry | undefined {
if (!threadId) {
return undefined;
}
Expand Down Expand Up @@ -592,6 +590,13 @@ export function optimisticallyInsertThread(
hasPendingInteraction: false,
pinSortKey: null,
environmentWorkspaceDisplayKind: "other",
// "pending" mirrors what the server returns before the first snapshot
// refresh; "not_applicable" would wrongly assert the environment can
// have no status.
environmentStatusSummary: {
git: { state: "pending" },
pullRequest: { state: "pending" },
},
},
...data,
]);
Expand Down
11 changes: 7 additions & 4 deletions apps/app/src/hooks/cache-owners/realtime-cache-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import {
allTerminalsQueryKeyPrefix,
environmentDiffFilesQueryKeyPrefix,
environmentFilePreviewQueryKeyPrefix,
environmentPullRequestQueryKey,
environmentWorkStatusQueryKeyPrefix,
hostsQueryKey,
sidebarNavigationQueryKey,
Expand Down Expand Up @@ -326,6 +325,13 @@ export const REALTIME_THREAD_CHANGE_REGISTRY = {
dirtyThreadStorageQueriesForThread, // Thread storage is resolved through the attached environment.
],
},
"environment-status-summary-changed": {
flush: "debounced",
dirty: [
dirtyThreadListQueries, // Plugin sidebar rows read PR signals from list entries.
dirtyThreadDetailQueries, // ThreadDetailView derives its PR banner from the detail summary.
],
},
"read-state-changed": {
flush: "debounced",
dirty: [
Expand Down Expand Up @@ -812,9 +818,6 @@ function dirtyEnvironmentLiveWorkspaceStateQueries({
queryClient.invalidateQueries({
queryKey: environmentWorkStatusQueryKeyPrefix(environmentId),
});
queryClient.invalidateQueries({
queryKey: environmentPullRequestQueryKey(environmentId),
});
queryClient.invalidateQueries({
queryKey: environmentFilePreviewQueryKeyPrefix(environmentId),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ function makeThreadListEntry(id = "thread-1"): ThreadListEntry {
},
pinSortKey: null,
hasPendingInteraction: false,
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
environmentHostId: "host-1",
environmentName: "Environment",
environmentBranchName: "main",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ function makeThreadListEntry(
environmentName: "Environment",
environmentBranchName: "main",
environmentWorkspaceDisplayKind: "managed-worktree",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
...thread,
};
}
Expand Down
8 changes: 8 additions & 0 deletions apps/app/src/hooks/mutations/thread-state-mutations.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ function makeThreadResponse(
return {
...makeThreadWithRuntime(thread),
canSpawnChild: true,
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
...thread,
};
}
Expand All @@ -84,6 +88,10 @@ function makeThreadListEntry(
environmentName: "Environment",
environmentBranchName: "main",
environmentWorkspaceDisplayKind: "managed-worktree",
environmentStatusSummary: {
git: { state: "not_applicable", refreshedAt: 1 },
pullRequest: { state: "not_applicable", refreshedAt: 1 },
},
...thread,
};
}
Expand Down
Loading
Loading