fix(git): let the remote action error be dismissed

Git's stderr for a rejected push is a screenful of help text that grew the docked footer and had no way out until the next action. The error now keeps its full height and carries a dismiss control.
This commit is contained in:
hairyf committed 2026-10-14 00:01:17 +08:00
1 parent 5efc7beae0
commit 98a5cb36c4
3 files changed
+21 -3

No files matched your search

+7 -2
View File
@@ -10,7 +10,8 @@
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type MouseEvent, type ReactNode } from 'react'
import {
Button, IconBranchOutlineRegular, IconCheckOutlineRegular, IconChevronRightOutlineRegular,
IconCodeOutlineRegular, IconCopyOutlineRegular, IconEllipsisOutlineRegular, IconPlusOutlineRegular,
IconCloseFillRegular, IconCodeOutlineRegular, IconCopyOutlineRegular, IconEllipsisOutlineRegular,
IconPlusOutlineRegular,
IconRefreshOutlineRegular, IconSparkleRegular, IconTrashOutlineRegular, Menu, writeClipboard,
} from '@deepseek-ai/dsh-client-ui-primitives'
import type { Context } from '../../context-types.ts'
@@ -1090,7 +1091,11 @@ export function GitLens(props: GitLensProps) {
{/* A sibling of the scroller: usable even with both sections folded. */}
{isRepo && <div className={css.gitFooter} data-git-footer>
{actionError !== null && <Notice kind="error" tone="inline" role="alert">{actionError}</Notice>}
{actionError !== null && <Notice kind="error" tone="inline" role="alert" className={css.actionError}>
<span className={css.actionErrorText}>{actionError}</span>
<IconButton size="sm" icon={<IconCloseFillRegular size={12} />} label={t('dismiss')}
onClick={() => { setActionError(null) }} />
</Notice>}
<div className={css.footerRow} data-footer-row>
<Menu open={branchOpen} onClose={() => { setBranchOpen(false) }} portal compact side="top" autoFocus
className={css.branchMenu}
+6
View File
@@ -51,6 +51,12 @@
tab — the branch control must never leave the bottom of the pane. */
.gitFooter { flex: none; min-width: 0; position: sticky; bottom: 0; z-index: 1; border-top: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-base); }
.footerRow { display: flex; align-items: center; min-width: 0; min-height: 28px; }
/* A failed remote op reports above the branch row and git's stderr can be long:
it keeps its own height (never truncated) but gets a dismiss control instead
of living in the docked footer until the next action. */
.actionError { display: flex; align-items: flex-start; gap: 6px; white-space: normal; }
.actionErrorText { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.branchMenu { display: flex; flex: 1; min-width: 0; }
.branchButton, .syncButton { display: flex; align-items: center; gap: 5px; min-width: 0; min-height: 28px; padding: 3px 8px; border: none; background: transparent; color: var(--dsw-alias-label-secondary); font: var(--dsw-font-xxxs-11); cursor: pointer; }
.branchButton { flex: 1; text-align: left; }
+8 -1
View File
@@ -107,7 +107,14 @@ describe('GitLens More Actions menu: remote actions', () => {
const error = errorLine(container, `${t('pullError')}: Not possible to fast-forward`)
expect(error).toBeDefined()
expect(container.querySelectorAll('[role="alert"]')).toHaveLength(1)
expect(error!.parentElement).toBe(container.querySelector('[data-git-footer]'))
expect(container.querySelector('[data-git-footer]')!.contains(error!)).toBe(true)
// A screenful of git stderr keeps its height but must be dismissible
// instead of squatting in the docked footer.
const dismiss = error!.querySelector<HTMLButtonElement>(`button[aria-label="${t('dismiss')}"]`)
expect(dismiss).not.toBeNull()
act(() => { dismiss!.click() })
expect(container.querySelectorAll('[role="alert"]')).toHaveLength(0)
} finally {
act(() => { root.unmount() })
container.remove()