Skip to content

fix(ui): revert theme preview when quitting from theme dialog - #25580

Closed
mvanhorn wants to merge 1 commit into
google-gemini:mainfrom
mvanhorn:fix/22541-theme-dialog-revert-on-quit
Closed

mvanhorn wants to merge 1 commit into
google-gemini:mainfrom
mvanhorn:fix/22541-theme-dialog-revert-on-quit

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

When the Theme Dialog is open and the user highlights a theme (which previews it immediately), then exits the CLI via double Ctrl+C or Ctrl+D without pressing Enter, the preview theme stays applied to the goodbye banner and the post-exit terminal state.

useThemeCommand.closeThemeDialog already re-applies the saved theme on close (packages/cli/src/ui/hooks/useThemeCommand.ts:80-84), so the fix is to invoke it from the quit action handler before setQuittingMessages fires.

Details

Previous attempt: PR #22542 landed this exact 2-line shape and was closed 2026-04-08 by the 14-day stale-PR auto-close (the issue was not labeled help wanted at the time). @psinha40898 confirmed the final shape was correct on that PR: "iirc the PR is now using the action registry to execute the logic on user press, akin to an event handler." The issue was subsequently labeled help wanted on 2026-04-08 by @cocosheng-g, which is why this re-submission.

The diff is intentionally minimal and matches the accepted shape. No changes to ThemeDialog.tsx or useThemeCommand.ts - the fix belongs in the quit event handler, not the component or hook.

Related Issues

Fixes #22541

How to Validate

  1. npm install && npm run build
  2. npm run start
  3. Run /theme inside the CLI
  4. Arrow down to highlight a different theme (preview applies)
  5. Do NOT press Enter
  6. Press Ctrl+C twice to exit
  7. Verify: the "Goodbye" banner and your terminal prompt use the originally saved theme, not the preview
  8. Repeat with Ctrl+D twice instead of Ctrl+C twice

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

This contribution was developed with AI assistance (Claude Code).

When the Theme Dialog is open and the user highlights a theme (which
previews it immediately) then exits via double Ctrl+C or Ctrl+D without
pressing Enter, the preview theme remains applied to the goodbye banner
and the post-exit terminal state.

useThemeCommand.closeThemeDialog already re-applies the saved theme on
close (packages/cli/src/ui/hooks/useThemeCommand.ts:80-84), so the fix
is to invoke it from the quit action handler in AppContainer before
setting quitting messages. Also add it to the surrounding useMemo
dependency array.

Fixes google-gemini#22541
@mvanhorn
mvanhorn requested a review from a team as a code owner April 17, 2026 12:47
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 addresses a UI bug where the terminal theme remains stuck on a previewed state if the user exits the CLI while the theme dialog is active. By ensuring the theme cleanup logic is triggered during the quit process, the application now correctly reverts to the user's saved theme upon exit, maintaining consistent terminal styling.

Highlights

  • Theme Preview Persistence: Fixed an issue where theme previews would persist in the terminal after exiting the CLI without confirming a theme selection.
  • Cleanup Logic: Integrated the existing closeThemeDialog function into the quit action handler to ensure the original theme is restored before the application exits.
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.

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.

@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 updates the quit function in AppContainer.tsx to ensure the theme dialog is closed when the application exits. It also adds closeThemeDialog to the relevant dependency array. I have no feedback to provide.

@JayadityaGit

Copy link
Copy Markdown
Contributor
isnn-Photoroom

"I see no noise" Great Job !

I love it, it fixes the bug !

I will the tag the mainatainers !

@cocosheng-g , @jacob314 , @jackwotherspoon

@jackwotherspoon

Copy link
Copy Markdown
Collaborator

Let me just re-open and merge @JayadityaGit's original PR 👍

That way original author gets credit for the change, thanks for flagging 🙏

@jackwotherspoon

Copy link
Copy Markdown
Collaborator

Previous PR for this is in the merge queue ✅

#22542

@wissamblue69-dotcom

Copy link
Copy Markdown

Summary

When the Theme Dialog is open and the user highlights a theme (which previews it immediately), then exits the CLI via double Ctrl+C or Ctrl+D without pressing Enter, the preview theme stays applied to the goodbye banner and the post-exit terminal state.

useThemeCommand.closeThemeDialog already re-applies the saved theme on close (packages/cli/src/ui/hooks/useThemeCommand.ts:80-84), so the fix is to invoke it from the quit action handler before setQuittingMessages fires.

Details

Previous attempt: PR #22542 landed this exact 2-line shape and was closed 2026-04-08 by the 14-day stale-PR auto-close (the issue was not labeled help wanted at the time). @psinha40898 confirmed the final shape was correct on that PR: "iirc the PR is now using the action registry to execute the logic on user press, akin to an event handler." The issue was subsequently labeled help wanted on 2026-04-08 by @cocosheng-g, which is why this re-submission.

The diff is intentionally minimal and matches the accepted shape. No changes to ThemeDialog.tsx or useThemeCommand.ts - the fix belongs in the quit event handler, not the component or hook.

Related Issues

Fixes #22541

How to Validate

  1. npm install && npm run build
  2. npm run start
  3. Run /theme inside the CLI
  4. Arrow down to highlight a different theme (preview applies)
  5. Do NOT press Enter
  6. Press Ctrl+C twice to exit
  7. Verify: the "Goodbye" banner and your terminal prompt use the originally saved theme, not the preview
  8. Repeat with Ctrl+D twice instead of Ctrl+C twice

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

This contribution was developed with AI assistance (Claude Code).

@sripasg sripasg added the size/xs An extra small PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs An extra small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Theme Dialog preview theme is not reverted when quitting via double Ctrl+C and Ctrl+D

5 participants