Refine refresh static logic (#1349)
This commit is contained in:
parent
1faf53a3af
commit
fcb8be2fb9
|
@ -239,7 +239,6 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
|
||||||
const pendingHistoryItems = [...pendingSlashCommandHistoryItems];
|
const pendingHistoryItems = [...pendingSlashCommandHistoryItems];
|
||||||
|
|
||||||
const { rows: terminalHeight, columns: terminalWidth } = useTerminalSize();
|
const { rows: terminalHeight, columns: terminalWidth } = useTerminalSize();
|
||||||
const lastTerminalWidth = useRef(terminalWidth);
|
|
||||||
const isInitialMount = useRef(true);
|
const isInitialMount = useRef(true);
|
||||||
const { stdin, setRawMode } = useStdin();
|
const { stdin, setRawMode } = useStdin();
|
||||||
const isValidPath = useCallback((filePath: string): boolean => {
|
const isValidPath = useCallback((filePath: string): boolean => {
|
||||||
|
@ -319,11 +318,9 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
|
||||||
|
|
||||||
if (key.ctrl && input === 'o') {
|
if (key.ctrl && input === 'o') {
|
||||||
setShowErrorDetails((prev) => !prev);
|
setShowErrorDetails((prev) => !prev);
|
||||||
refreshStatic();
|
|
||||||
} else if (key.ctrl && input === 't') {
|
} else if (key.ctrl && input === 't') {
|
||||||
const newValue = !showToolDescriptions;
|
const newValue = !showToolDescriptions;
|
||||||
setShowToolDescriptions(newValue);
|
setShowToolDescriptions(newValue);
|
||||||
refreshStatic();
|
|
||||||
|
|
||||||
const mcpServers = config.getMcpServers();
|
const mcpServers = config.getMcpServers();
|
||||||
if (Object.keys(mcpServers || {}).length > 0) {
|
if (Object.keys(mcpServers || {}).length > 0) {
|
||||||
|
@ -475,16 +472,14 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
|
||||||
|
|
||||||
// debounce so it doesn't fire up too often during resize
|
// debounce so it doesn't fire up too often during resize
|
||||||
const handler = setTimeout(() => {
|
const handler = setTimeout(() => {
|
||||||
if (terminalWidth < lastTerminalWidth.current) {
|
setStaticNeedsRefresh(false);
|
||||||
setStaticNeedsRefresh(true);
|
refreshStatic();
|
||||||
}
|
|
||||||
lastTerminalWidth.current = terminalWidth;
|
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearTimeout(handler);
|
clearTimeout(handler);
|
||||||
};
|
};
|
||||||
}, [terminalWidth]);
|
}, [terminalWidth, terminalHeight, refreshStatic]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!pendingHistoryItems.length) {
|
if (!pendingHistoryItems.length) {
|
||||||
|
|
Loading…
Reference in New Issue