feat(cli): add global setting to disable UI spinners (#17234)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Gal Zahavi
2026-01-26 16:06:58 -08:00
committed by GitHub
parent 49c26b4801
commit 00f60ef532
7 changed files with 71 additions and 18 deletions

View File

@@ -7,16 +7,27 @@
import Spinner from 'ink-spinner';
import { type ComponentProps, useEffect } from 'react';
import { debugState } from '../debug.js';
import { useSettings } from '../contexts/SettingsContext.js';
export type SpinnerProps = ComponentProps<typeof Spinner>;
export const CliSpinner = (props: SpinnerProps) => {
const settings = useSettings();
const shouldShow = settings.merged.ui?.showSpinner !== false;
useEffect(() => {
debugState.debugNumAnimatedComponents++;
return () => {
debugState.debugNumAnimatedComponents--;
};
}, []);
if (shouldShow) {
debugState.debugNumAnimatedComponents++;
return () => {
debugState.debugNumAnimatedComponents--;
};
}
return undefined;
}, [shouldShow]);
if (!shouldShow) {
return null;
}
return <Spinner {...props} />;
};