fix: resolve React console warning in UserMessageBody truncation#1431
Open
VascoSch92 wants to merge 1 commit into
Open
fix: resolve React console warning in UserMessageBody truncation#1431VascoSch92 wants to merge 1 commit into
VascoSch92 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
✅ Mock-LLM E2E Tests10/10 passed Commit:
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
Contributor
✅ Mock-LLM Docker E2E Test Results60/60 passed Commit:
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN:
Fixing a small regression bug.
AGENT:
I ran the targeted regression test, which directly reproduces the bug: it renders a long user message, waits for truncation to be measured, and spies on
console.errorto assert the React cross-component-update warning is no longer emitted. The asserted string is the bug, so this test is a faithful check of the fix.I did not launch the full dev server / browser session — manual in-app verification is left for the human tester (checkbox above).
Why
A React console warning fired whenever a long user message was rendered:
UserMessageBodycalled the parent'sonTruncatableChange(i.e.ChatMessage'ssetIsTruncatable) from inside its ownsetIsTruncatableupdater during the render phase — a render-phase state update to a different component.The buggy code lives on
main(introduced in #1374 whenUserMessageBodywas extracted), so the warning affectsmaindirectly. The fix was authored by @DevinVinson and committed onto thefeat/ptebranch (#1312); this PR cherry-picks it onto its own branch so it can land independently of that unrelated feature.Summary
onTruncatableChangenotification out of the render-phasesetIsTruncatableupdater into a dedicateduseEffect, keeping theuseLayoutEffectmeasurement pure.Issue Number
N/A
How to Test
Manual check: run the dev server, send a long (>3 line or >220 char) user message in chat, open the browser console, and confirm no "Cannot update a component (
ChatMessage) while rendering a different component (UserMessageBody)" warning appears. Revertingsrc/components/features/chat/user-message-body.tsxreproduces it.Video/Screenshots
N/A — console-warning fix; the regression test captures the absence of the warning via a
console.errorspy (output in the AGENT section above).Type
Notes
feat/pte(settings: add parallel tool calls (tool_concurrency_limit) to Agent Settings #1312) with authorship preserved on the commit.6e81ba04can be dropped fromfeat/pteso the fix ships only here.🐳 Docker images for this PR
• GHCR package: https://github.com/OpenHands/agent-canvas/pkgs/container/agent-canvas
ghcr.io/openhands/agent-canvasghcr.io/openhands/agent-server:1.28.1-pythonopenhands-automation==1.0.0a10fb403daf5571de538e9daf584057d9e12ae3743ePull (multi-arch manifest)
# Multi-arch manifest — Docker automatically pulls the correct architecture docker pull ghcr.io/openhands/agent-canvas:sha-fb403daRun
All tags pushed for this build
About Multi-Architecture Support
sha-fb403da) is a multi-arch manifest supporting both amd64 and arm64sha-fb403da-amd64) are also available if needed