Fix log groups collapsing on auto-refresh in Logs view#65378
Merged
pierrejeambrun merged 1 commit intoApr 16, 2026
Merged
Conversation
Log group sections (::group::) were auto-collapsing whenever the UI auto-refreshed or the user scrolled. Two issues combined to cause this: 1. LogBlock.onClick mutated the unfoldedGroups array in-place (.push, .splice) then passed the same reference to setState. React uses Object.is for state comparison — same reference means the update is silently discarded. This worked by accident in React 18 but broke after the React 19 upgrade (7d4c79b). 2. Chakra UI Tabs with isLazy (default lazyBehavior="unmount") unmounts inactive panels, resetting all component state on remount. Fix: use immutable state updates (spread/filter to create new arrays) so React properly detects changes, and add lazyBehavior="keepMounted" so tab panels preserve their state once rendered. closes: apache#65200
bbovenzi
approved these changes
Apr 16, 2026
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.
Fix log groups (::group::) auto-collapsing whenever the UI auto-refreshes
or the user scrolls the log area.
LogBlock.onClickmutated theunfoldedGroupsarray in-place (.push,.splice) then passed the same reference tosetState. React 19uses strict
Object.iscomparison — same reference means the stateupdate is silently discarded, so
useMemonever recalculates theparsed logs with the correct unfolded state.
Chakra UI
TabswithisLazydefaults tolazyBehavior="unmount",which unmounts inactive tab panels. Any remount resets
useState([])to empty, losing the unfolded groups entirely.
Fix:
[...prev, gId]/prev.filter(...))so React detects the state change.
lazyBehavior="keepMounted"to the Tabs so panels preserve stateonce rendered (still lazy on initial load).
Before
Screen.Recording.2026-04-16.at.18.26.20.mov
After
Screen.Recording.2026-04-16.at.18.23.03.mov
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.6) following the guidelines