Skip to content

chore: use svelte's tick#83

Merged
stevekaplan123 merged 2 commits intomainfrom
feature/sc-42706/responses-should-enter-the-message-canvas
Mar 19, 2026
Merged

chore: use svelte's tick#83
stevekaplan123 merged 2 commits intomainfrom
feature/sc-42706/responses-should-enter-the-message-canvas

Conversation

@stevekaplan123
Copy link
Contributor

@stevekaplan123 stevekaplan123 commented Mar 16, 2026

Updates the chat UI’s scroll behavior to scroll to the start of the latest LA response rather than scrolling to the bottom. Essential to implementing this is relying on Svelte’s DOM-flush lifecycle (tick()) instead of a setTimeout delay.

Changes:

  • Replace setTimeout(..., 50)-based scrolling with await tick() in scrollToBottom(). tick is a built-in Svelte function that returns a promise when the DOM lifecycle has been finished. That way we don't have to guess 50 seconds and can scroll once svelte is finished updating the DOM with the new assistant message.
  • Add scrollToResponseStart() and switch post-response scrolling to align the latest assistant message at the top of the message list.

@stevekaplan123 stevekaplan123 marked this pull request as ready for review March 17, 2026 09:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the chat UI’s scroll behavior to rely on Svelte’s DOM-flush lifecycle (tick()) instead of a setTimeout delay, and introduces a new scroll mode that targets the start of the latest assistant response.

Changes:

  • Replace setTimeout(..., 50)-based scrolling with await tick() in scrollToBottom().
  • Add scrollToResponseStart() and switch post-response scrolling to align the latest assistant message at the top of the message list.
  • Stop triggering scrollToBottom() during streaming progress updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 497 to 500
messages = [...messages, assistantMessage];
saveMessagesToStorage();
scrollToBottom();
scrollToResponseStart();
@stevekaplan123 stevekaplan123 requested a review from saengel March 17, 2026 09:52
@stevekaplan123 stevekaplan123 merged commit dad8afe into main Mar 19, 2026
1 check passed
@stevekaplan123 stevekaplan123 deleted the feature/sc-42706/responses-should-enter-the-message-canvas branch March 19, 2026 11:49
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.

3 participants