Skip to content

bug(ui) fix flicker refreshing background color - #19041

Merged
jacob314 merged 1 commit into
mainfrom
fix_background_update_flicker
Feb 13, 2026
Merged

bug(ui) fix flicker refreshing background color#19041
jacob314 merged 1 commit into
mainfrom
fix_background_update_flicker

Conversation

@jacob314

@jacob314 jacob314 commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Summary

We accidentally updated the theme and called refresh static even if the background color was unchanged

To test:
Dial "Terminal Background Polling Interval" to 1s and verify you do not see flicker in iterm2 when you have a somewhat long chat conversation.

Verify that after changing the background color of your terminal (the iterm2 appearance tab of the settings dialog makes this easy) that the theme still updates fully in gemini cli after a second has passed.

Verify that the ThemeDialog still successfully fully updates the theme after you change it.

Fixes #19040

@jacob314
jacob314 requested a review from a team as a code owner February 13, 2026 23:20
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jacob314, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a UI flickering issue by refining the mechanism for refreshing the static UI elements, particularly in response to terminal background color changes and theme selections. The changes ensure that UI refreshes are triggered only when genuinely necessary, preventing redundant re-renders and improving the overall visual stability and performance of the application's user interface.

Highlights

  • Refactored refreshStatic calls: The refreshStatic function, responsible for UI re-rendering, is now passed as a dependency to relevant hooks and components, centralizing its invocation.
  • Optimized terminal theme detection: The useTerminalTheme hook now includes logic to prevent unnecessary refreshStatic calls when the detected terminal background color has not actually changed.
  • Improved theme application flow: refreshStatic is now explicitly called after a theme is applied via useThemeCommand, ensuring the UI reflects the new theme correctly.
  • Removed redundant UI refresh in ThemeDialog: The ThemeDialog component no longer directly triggers refreshStatic, as this responsibility has been shifted to the useThemeCommand hook.
Changelog
  • packages/cli/src/ui/AppContainer.tsx
    • Added refreshStatic as a dependency to the useTerminalTheme hook.
  • packages/cli/src/ui/components/ThemeDialog.test.tsx
    • Removed mockRefreshStatic and its associated expectation, updating the test to verify onSelect instead.
  • packages/cli/src/ui/components/ThemeDialog.tsx
    • Removed the useUIActions context import and direct calls to refreshStatic within theme and scope selection handlers.
  • packages/cli/src/ui/hooks/useTerminalTheme.test.tsx
    • Imported themeManager.
    • Updated test setup to clear themeManager.setTerminalBackground mocks.
    • Added new tests to verify refreshStatic is not called on identical background reports and that themeManager.setTerminalBackground is called.
  • packages/cli/src/ui/hooks/useTerminalTheme.ts
    • Implemented a check to prevent config.setTerminalBackground and themeManager.setTerminalBackground calls if the detected background color is the same as the previous one.
    • Moved the refreshStatic call to only execute when a theme doesn't switch but the background color does.
  • packages/cli/src/ui/hooks/useThemeCommand.ts
    • Modified the useThemeCommand hook to accept refreshStatic as an argument and call it after a theme is successfully applied.
Activity
  • No specific human activity (comments, reviews, progress updates) was provided in the pull request context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@google-gemini google-gemini deleted a comment from gemini-cli Bot Feb 13, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses a UI flicker issue related to background color refreshing. The refactoring centralizes the refreshStatic call, ensuring it's triggered only once per theme or background color change, which successfully prevents the double-refresh that caused the flicker. The logic is sound, moving the responsibility for the refresh into the useThemeCommand hook for explicit theme selections and handling adaptive theme refreshes correctly within useTerminalTheme. The updated tests accurately reflect and validate this improved behavior. Overall, this is a solid fix that enhances UI stability.

@github-actions

Copy link
Copy Markdown

Size Change: +123 B (0%)

Total Size: 24.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.4 MB +123 B (0%)
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@jacob314
jacob314 enabled auto-merge February 13, 2026 23:29
@jacob314
jacob314 added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit 401bef1 Feb 13, 2026
31 checks passed
@jacob314
jacob314 deleted the fix_background_update_flicker branch February 13, 2026 23:42
kuishou68 pushed a commit to iOfficeAI/gemini-cli-pro that referenced this pull request Feb 27, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
@sripasg sripasg added the size/m A medium sized PR label Jun 2, 2026
software-0ficial pushed a commit to software-0ficial/gemini-cli that referenced this pull request Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flicker each time we query for the background color

3 participants