Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chat): Fix scroll btn for large msg #1513

Merged
merged 4 commits into from
Nov 15, 2023
Merged

fix(chat): Fix scroll btn for large msg #1513

merged 4 commits into from
Nov 15, 2023

Conversation

Flemmli97
Copy link
Collaborator

What this PR does 📖

  • Currently if you have a large message (bigger than the screen) then our scrolling system will not detect when that message goes out of the viewport.
    This causes the scroll button to not appear (and if present not disappear). Can test this with a large message that was sent last in a chat.
    This PR fixes that problem

Copy link

coderabbitai bot commented Nov 14, 2023

Walkthrough

Walkthrough

The update to the observer_script.js involves enhancing the intersection observer functionality. A new variable, view_height, is introduced to determine the height of the viewable area, and the observer's initialization now includes a callback to handle the visibility of elements more precisely. The logic for determining which elements to observe has been refined to consider their height relative to the view height, optimizing the way messages are monitored within the chat interface.

Changes

File Path Change Summary
ui/src/layouts/chats/scripts/observer_script.js Introduced view_height variable; updated observer initialization with a callback; refined logic for element observation based on height comparison with view_height.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@github-actions github-actions bot added Don't merge yet DO NOT MERGE Missing dev review Still needs to be reviewed by a dev labels Nov 14, 2023
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 7cdd46e and c40d17d.
Files selected for processing (1)
  • ui/src/layouts/chats/scripts/observer_script.js (2 hunks)
Additional comments: 5
ui/src/layouts/chats/scripts/observer_script.js (5)
  • 5-5: The variable view_height is calculated as 80% of the msg_view height. This seems to be a design decision, but it's worth verifying that this percentage is appropriate for all screen sizes and message lengths.

  • 11-14: The callback function for the observer is correctly checking if the element with conversation_key exists and disconnects the observer if not. This is good for performance and avoids potential errors.

  • 33-34: The else block sends a "Remove" message when an element is no longer intersecting. This seems to be part of the logic to manage the visibility of the scroll button. Ensure that the corresponding backend service is expecting this format and that it correctly handles these messages.

  • 40-40: The threshold is set to 0.95, which means the callback will only be called when 95% of the target is visible within the root. Verify that this threshold is appropriate for the desired behavior of the scroll button.

  • 57-58: The observe_list function is immediately invoked at the end of the script. This is fine as long as the script is loaded when the DOM is ready. Otherwise, it could try to access elements that are not yet available. Verify that the script is included at the correct point in the page lifecycle.

Copy link
Contributor

github-actions bot commented Nov 14, 2023

UI Automated Test Results Summary for MacOS/Windows

477 tests   364 ✔️  2h 52m 10s ⏱️
  41 suites  113 💤
    3 files        0

Results for commit a981073.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Nov 14, 2023

UI Automated Tests execution is complete! You can find the test results report here

@github-actions github-actions bot added Failed Automated Test This PR is failing Luis's Appium test and needs revised and removed Failed Automated Test This PR is failing Luis's Appium test and needs revised labels Nov 14, 2023
@phillsatellite phillsatellite added Waiting for CI Waiting for at least one CI job to complete before merging QA Tested QA has tested and approved Ready to Merge This PR is ready to merge and removed Missing dev review Still needs to be reviewed by a dev Don't merge yet DO NOT MERGE Waiting for CI Waiting for at least one CI job to complete before merging labels Nov 15, 2023
@stavares843 stavares843 merged commit 70399e6 into dev Nov 15, 2023
10 checks passed
@stavares843 stavares843 deleted the fix_scroll_btn branch November 15, 2023 19:06
@github-actions github-actions bot removed QA Tested QA has tested and approved Ready to Merge This PR is ready to merge labels Nov 15, 2023
sdwoodbury added a commit that referenced this pull request Dec 4, 2023
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.

4 participants