mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-19 17:50:37 -07:00
fix: respect hideContextPercentage when FooterConfigDialog is closed without changes (#24773)
Co-authored-by: Coco Sheng <cocosheng@google.com>
This commit is contained in:
@@ -13,7 +13,11 @@ import { useUIState } from '../contexts/UIStateContext.js';
|
||||
import { useKeypress, type Key } from '../hooks/useKeypress.js';
|
||||
import { Command } from '../key/keyMatchers.js';
|
||||
import { FooterRow, type FooterRowItem } from './Footer.js';
|
||||
import { ALL_ITEMS, resolveFooterState } from '../../config/footerItems.js';
|
||||
import {
|
||||
ALL_ITEMS,
|
||||
resolveFooterState,
|
||||
deriveItemsFromLegacySettings,
|
||||
} from '../../config/footerItems.js';
|
||||
import { SettingScope } from '../../config/settings.js';
|
||||
import { BaseSelectionList } from './shared/BaseSelectionList.js';
|
||||
import type { SelectionListItem } from '../hooks/useSelectionList.js';
|
||||
@@ -137,17 +141,16 @@ export const FooterConfigDialog: React.FC<FooterConfigDialogProps> = ({
|
||||
const handleSaveAndClose = useCallback(() => {
|
||||
const finalItems = orderedIds.filter((id: string) => selectedIds.has(id));
|
||||
const currentSetting = settings.merged.ui?.footer?.items;
|
||||
if (JSON.stringify(finalItems) !== JSON.stringify(currentSetting)) {
|
||||
// When items haven't been explicitly set yet (legacy mode), compare against
|
||||
// the legacy-derived items to avoid persisting items and silently overriding
|
||||
// legacy boolean settings like hideContextPercentage.
|
||||
const effectiveCurrent =
|
||||
currentSetting ?? deriveItemsFromLegacySettings(settings.merged);
|
||||
if (JSON.stringify(finalItems) !== JSON.stringify(effectiveCurrent)) {
|
||||
setSetting(SettingScope.User, 'ui.footer.items', finalItems);
|
||||
}
|
||||
onClose?.();
|
||||
}, [
|
||||
orderedIds,
|
||||
selectedIds,
|
||||
setSetting,
|
||||
settings.merged.ui?.footer?.items,
|
||||
onClose,
|
||||
]);
|
||||
}, [orderedIds, selectedIds, setSetting, settings.merged, onClose]);
|
||||
|
||||
const handleResetToDefaults = useCallback(() => {
|
||||
setSetting(SettingScope.User, 'ui.footer.items', undefined);
|
||||
|
||||
Reference in New Issue
Block a user