Skip to content

fix: message viewer performance degradation on expanded rows during streaming#2235

Merged
jvorcak merged 1 commit intorelease-2.8from
fix/message-viewer-perf-subcomponent-instability
Feb 20, 2026
Merged

fix: message viewer performance degradation on expanded rows during streaming#2235
jvorcak merged 1 commit intorelease-2.8from
fix/message-viewer-perf-subcomponent-instability

Conversation

@weeco
Copy link
Copy Markdown
Contributor

@weeco weeco commented Feb 20, 2026

Summary

  • Stabilize subComponent identity in MessageTable using useCallback — prevents React from unmounting/remounting all expanded Monaco editors on every MobX-triggered re-render during gRPC streaming
  • Replace Monaco automaticLayout with a single debounced ResizeObserver per editor — eliminates cascading layout recalculations and fixes existing Safari infinite loop
  • Memoize JSON.stringify in KowlJsonView to skip redundant serialization on re-renders
  • Remove dead code (expandedKeys, toggleRecordExpand) left over from the pre-DataTable migration

Root cause

MessageTable is a MobX observer that re-renders on every message push during gRPC streaming search. The subComponent prop was an inline arrow function, so each re-render created a new function reference. DataTable uses this as a React component type — when the reference changes, React treats it as a different component, unmounting the old tree and mounting a new one for every expanded row. Each cycle destroys and recreates Monaco editor instances, causing 21+ seconds of pure scripting on protobuf-schema topics.

Verified with Playwright

Metric Before After
Monaco destructions (10 rapid pushes, 2 expanded editors) ~55 0
Monaco creations ~55 0
Editor stability Flicker/remount each push Stable, no flicker

@weeco weeco requested a review from jvorcak February 20, 2026 11:58
… editor remounting

The subComponent prop passed to DataTable was an inline arrow function,
causing React to treat it as a new component type on every MobX-triggered
re-render. During gRPC streaming searches, each arriving message triggered
a re-render that unmounted and remounted all expanded Monaco editors,
leading to 21+ seconds of scripting on protobuf-schema topics.

- Wrap subComponent, onCopyKey, onCopyValue in useCallback for stable refs
- Memoize JSON.stringify in KowlJsonView to avoid redundant serialization
- Remove dead expandedKeys/toggleRecordExpand code from pre-DataTable era
@weeco weeco force-pushed the fix/message-viewer-perf-subcomponent-instability branch from 7635a4c to d6b8842 Compare February 20, 2026 12:03
@jvorcak jvorcak merged commit 9a5ad34 into release-2.8 Feb 20, 2026
7 checks passed
@jvorcak jvorcak deleted the fix/message-viewer-perf-subcomponent-instability branch February 20, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants