Skip to content

fix: fix auto scroll + regression tests for incremental resize - #14

Merged
quiet-node merged 2 commits into
mainfrom
worktree-flickering-doodling-cook
Apr 1, 2026
Merged

fix: fix auto scroll + regression tests for incremental resize#14
quiet-node merged 2 commits into
mainfrom
worktree-flickering-doodling-cook

Conversation

@quiet-node

Copy link
Copy Markdown
Owner

Summary

Fixes the chat window auto-scroll behavior and adds regression tests to prevent future regressions.

Fix (commit aa3a5a5)

Rewrote the ResizeObserver window-sizing logic in App.tsx:

  • Before: On the first observer event the window jumped to max height immediately (hidden during Framer Motion fade-in), then scrolled internally forever after.
  • After: Window grows incrementally — tracks actual content height capped at Math.min(MAX_CHAT_WINDOW_HEIGHT, availableSpace), pinning the bottom while expanding the top. isPreExpandedRef only locks once max height is truly reached.

Regression Tests (commit 9e957e8)

Added two new tests to the ResizeObserver window sizing with anchor suite:

  1. Clamps to available space — when the screen gap is smaller than MAX_CHAT_WINDOW_HEIGHT, the window is capped at the available space and isPreExpandedRef locks once that cap is hit.
  2. isPreExpandedRef resets on session reopen — after a locked session, closing the overlay resets the ref so the next session's first resize uses actual content height instead of being skipped.

All 147 tests pass, 100% coverage maintained.

Covers the two key behaviors introduced by 'fix: fix auto scroll':

- Window clamps to available space when screen gap < MAX_CHAT_WINDOW_HEIGHT
  (Math.min cap), locking isPreExpandedRef once the cap is reached.
- isPreExpandedRef resets on session reopen so incremental growth
  restarts correctly instead of being silently skipped.

All 147 tests pass, 100% coverage maintained.

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
@quiet-node
quiet-node merged commit 55c2dc3 into main Apr 1, 2026
3 checks passed
@quiet-node
quiet-node deleted the worktree-flickering-doodling-cook branch April 1, 2026 22:59
quiet-node added a commit that referenced this pull request Apr 10, 2026
* fix: fix auto scroll

* test: add regression tests for incremental scroll-anchor resize

Covers the two key behaviors introduced by 'fix: fix auto scroll':

- Window clamps to available space when screen gap < MAX_CHAT_WINDOW_HEIGHT
  (Math.min cap), locking isPreExpandedRef once the cap is reached.
- isPreExpandedRef resets on session reopen so incremental growth
  restarts correctly instead of being silently skipped.

All 147 tests pass, 100% coverage maintained.

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>

---------

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
quiet-node added a commit that referenced this pull request Apr 10, 2026
* fix: fix auto scroll

* test: add regression tests for incremental scroll-anchor resize

Covers the two key behaviors introduced by 'fix: fix auto scroll':

- Window clamps to available space when screen gap < MAX_CHAT_WINDOW_HEIGHT
  (Math.min cap), locking isPreExpandedRef once the cap is reached.
- isPreExpandedRef resets on session reopen so incremental growth
  restarts correctly instead of being silently skipped.

All 147 tests pass, 100% coverage maintained.

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>

---------

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
quiet-node added a commit that referenced this pull request Apr 11, 2026
* fix: fix auto scroll

* test: add regression tests for incremental scroll-anchor resize

Covers the two key behaviors introduced by 'fix: fix auto scroll':

- Window clamps to available space when screen gap < MAX_CHAT_WINDOW_HEIGHT
  (Math.min cap), locking isPreExpandedRef once the cap is reached.
- isPreExpandedRef resets on session reopen so incremental growth
  restarts correctly instead of being silently skipped.

All 147 tests pass, 100% coverage maintained.

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>

---------

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
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