Skip to content

Commit 9e89122

Browse files
fix(web): refresh git status when pointing at an empty actions menu
A disabled trigger cannot open, so it lost the menu-open status refresh that surfaced edits made outside agent turns (for example in a terminal). AI-assisted; verified with the tests and tools listed above.
1 parent a8652d3 commit 9e89122

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎apps/web/src/components/GitActionsControl.tsx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,19 @@ const inlineSuccessExpiresAt = () => Date.now() + GIT_ACTION_SUCCESS_VISIBLE_MS;
154154

155155
type RefreshVcsStatus = (target: {
156156
readonly environmentId: ScopedThreadRef["environmentId"];
157-
readonly input: { readonly cwd: string };
157+
readonly input: { readonly cwd: string; readonly localOnly?: boolean };
158158
}) => Promise<unknown>;
159159

160160
function requestVcsStatusRefresh(
161161
refresh: RefreshVcsStatus,
162162
environmentId: ScopedThreadRef["environmentId"] | null,
163163
cwd: string | null,
164+
options?: { readonly localOnly: boolean },
164165
): void {
165166
if (environmentId === null || cwd === null) {
166167
return;
167168
}
168-
void refresh({ environmentId, input: { cwd } });
169+
void refresh({ environmentId, input: { cwd, ...options } });
169170
}
170171
const RUNNING_SOURCE_CONTROL_ACTIONS = ["runStackedAction", "pull", "publishRepository"] as const;
171172

@@ -1410,6 +1411,9 @@ export default function GitActionsControl({
14101411
hasNotice: isDetachedHead || isCleanAndBehind || Boolean(gitStatusError),
14111412
});
14121413

1414+
const refreshLocalStatus = () =>
1415+
requestVcsStatusRefresh(refreshVcsStatus, activeEnvironmentId, gitCwd, { localOnly: true });
1416+
14131417
const initializeGit = () => {
14141418
void (async () => {
14151419
const result = await initAction.run();
@@ -1516,6 +1520,9 @@ export default function GitActionsControl({
15161520
role="group"
15171521
aria-label="Git actions"
15181522
ref={panelAnchorRef}
1523+
// A disabled menu cannot refresh on open, and terminal edits publish no status.
1524+
onPointerEnter={hasGitMenuContent ? undefined : refreshLocalStatus}
1525+
onFocus={hasGitMenuContent ? undefined : refreshLocalStatus}
15191526
className={cn(
15201527
"shrink-0",
15211528
THREAD_DETAILS_PANEL_SPLIT_GROUP_CLASS,

0 commit comments

Comments
 (0)