Skip to content

fix(tui): auto-scroll via onContentHeightChange callback#507

Closed
avoidwork wants to merge 1 commit into
mainfrom
fix-scrolling
Closed

fix(tui): auto-scroll via onContentHeightChange callback#507
avoidwork wants to merge 1 commit into
mainfrom
fix-scrolling

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Replace the messages-state-dependent scroll effect with ScrollView's onContentHeightChange callback. The previous approach tracked message count and streaming content hash, but never fired during streaming because messagesRef.current mutations don't change the messages array reference.

onContentHeightChange fires when ink-scroll-view's internal content height actually changes — driven by MeasurableItem useLayoutEffect measurements — so it catches both streaming text growth and new messages without any state churn.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

Describe the tests you wrote/run and their coverage. Use "N/A" if not applicable.

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Replace the messages-state-dependent scroll effect with ScrollView's
onContentHeightChange callback. The previous approach tracked message
count and streaming content hash, but never fired during streaming
because messagesRef.current mutations don't change the messages
array reference.

onContentHeightChange fires when ink-scroll-view's internal content
height actually changes — driven by MeasurableItem useLayoutEffect
measurements — so it catches both streaming text growth and new
messages without any state churn.
@avoidwork avoidwork closed this Jul 2, 2026
@avoidwork avoidwork deleted the fix-scrolling branch July 2, 2026 23:24
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.

1 participant