Skip to content

Speculative fixes to try to fix react error.#19508

Merged
jacob314 merged 1 commit intomainfrom
render_depth_fix
Feb 19, 2026
Merged

Speculative fixes to try to fix react error.#19508
jacob314 merged 1 commit intomainfrom
render_depth_fix

Conversation

@jacob314
Copy link
Contributor

@jacob314 jacob314 commented Feb 19, 2026

Summary

These changes may or may not fix the issue but are generally harmless.

Speculative changes in hopes of fixing #19507

@jacob314 jacob314 requested a review from a team as a code owner February 19, 2026 06:01
@gemini-code-assist
Copy link
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 introduces speculative fixes aimed at resolving potential React errors by enhancing the stability and efficiency of UI component updates. It refines the useFocusHint hook to use a more robust mechanism for resetting its inactivity timer and significantly improves the useConsoleMessages hook's ability to handle concurrent updates by explicitly managing its processing state. These changes contribute to a more resilient and performant user interface, with corresponding adjustments made to related tests.

Highlights

  • Refactored useFocusHint hook: The useFocusHint hook in ToolShared.tsx was updated to remove the lastUpdateTime state and its associated useEffect. Instead, it now derives a resetKey from the resultDisplay property (using its length for strings/arrays or boolean conversion) to control the inactivity timer, aiming for more stable updates.
  • Improved useConsoleMessages hook: The useConsoleMessages hook was refactored to prevent potential React update queue flooding and overlapping concurrent updates. This involved replacing the useTransition hook with a direct startTransition import, introducing an isProcessingRef to manage message processing state, and increasing the message batching timeout from 16ms to 50ms.
  • Adjusted test timings: Tests in useConsoleMessages.test.tsx were updated to reflect the increased message batching timeout. vi.advanceTimersByTimeAsync calls were changed from 20ms to 60ms to ensure tests correctly account for the new delay.
Changelog
  • packages/cli/src/ui/components/messages/ToolShared.tsx
    • Removed lastUpdateTime state and its useEffect dependency.
    • Implemented a resetKey derived from resultDisplay to trigger the inactivity timer.
  • packages/cli/src/ui/hooks/useConsoleMessages.test.tsx
    • Increased vi.advanceTimersByTimeAsync calls from 20ms to 60ms in multiple tests.
  • packages/cli/src/ui/hooks/useConsoleMessages.ts
    • Replaced useTransition hook with direct startTransition import.
    • Introduced isProcessingRef to track the message processing state.
    • Increased message batching timeout from 16ms to 50ms.
    • Added a useEffect to reset isProcessingRef and process queued messages after consoleMessages update.
    • Set isProcessingRef to true when clearing messages to prevent immediate re-processing.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
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.

@gemini-cli
Copy link
Contributor

gemini-cli bot commented Feb 19, 2026

Hi @jacob314, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

Copy link
Contributor

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

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 introduces speculative fixes to enhance React component stability. The changes in useConsoleMessages.ts implement a more robust mechanism for batching state updates, effectively preventing potential race conditions. Similarly, the useFocusHint hook in ToolShared.tsx is refactored to use a derived key, which is a cleaner approach. These changes are solid improvements and follow best practices. The associated test updates are correct. I have no issues to report.

SHELL_FOCUS_HINT_DELAY_MS,
);

useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fyi @galz10 I'm a bit at a lost why we were using lastupdateTime as a key here. I think that was renerally a bug. Was the intent we should only delay showing the focus hint after the content of a tool actually changed?

As is this code would trigger an unneeded setState with every change to resultDisplay perhaps doubling the number of updates when there is a react update storm.

@github-actions
Copy link

Size Change: +276 B (0%)

Total Size: 24.5 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.5 MB +276 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

@gemini-cli gemini-cli bot added priority/p1 Important and should be addressed in the near term. area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 19, 2026
@jacob314 jacob314 added this pull request to the merge queue Feb 19, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 19, 2026
@jacob314 jacob314 added this pull request to the merge queue Feb 19, 2026
Merged via the queue into main with commit a804f99 Feb 19, 2026
29 of 30 checks passed
@jacob314 jacob314 deleted the render_depth_fix branch February 19, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants