Skip to content

Conversation

@aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Apr 10, 2025

Proposed changes (including videos or screenshots)

This PR fixes an issue where fetching entered an infinite loop when interacting with the AutoCompleteAgent component.

Cause:
The component internally uses the useAgentsList hook, which was incorrectly adding one to the total number of items. As a result, when Virtuoso rendered the list, endReached was triggered repeatedly because the total count (with the extra +1) was never truly reached. This led to loadMoreItems being called indefinitely.

Issue(s)

CTZ-38

Steps to test or reproduce

  • Access a premium workspace
  • Omnichannel > Departments
  • New department
  • Open dev tools network tab
  • Click "Agents" field
  • Type a agent's name
  • Repeated requests to the /v1/livechat/users/agent should start happening

Further comments


This pull request addresses an infinite loop issue in the useAgentsList hook within the Rocket.Chat repository. The changes include:

  1. Infinite Loop Fix: The useAgentsList hook had an issue with incorrect item count calculation, which has been resolved by removing the +1 adjustment to the total count.

  2. Accessibility Enhancements:

    • The AutoCompleteAgent and DepartmentAgentsTable components now support aria-labelledby for improved accessibility.
    • The AddAgent component has been updated with aria attributes and type safety improvements.
    • The EditDepartment component introduces unique IDs for form elements to ensure labels are correctly associated with their inputs.
  3. Type Safety Improvements: Type safety has been enhanced across several components by importing the AriaAttributes type from React.

These changes aim to improve both the functionality and accessibility of the Rocket.Chat application.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Apr 10, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Apr 10, 2025

🦋 Changeset detected

Latest commit: eb3370a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Apr 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.02%. Comparing base (ec78941) to head (eb3370a).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #35779      +/-   ##
===========================================
+ Coverage    60.96%   61.02%   +0.06%     
===========================================
  Files         2951     3099     +148     
  Lines        70290    73253    +2963     
  Branches     16167    16408     +241     
===========================================
+ Hits         42852    44705    +1853     
- Misses       24498    25519    +1021     
- Partials      2940     3029      +89     
Flag Coverage Δ
e2e 57.68% <100.00%> (+0.04%) ⬆️
unit 75.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 10, 2025

PR Preview Action v1.6.1

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-35779/

Built to branch gh-pages at 2025-04-15 20:37 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@aleksandernsilva aleksandernsilva marked this pull request as ready for review April 11, 2025 17:35
@aleksandernsilva aleksandernsilva requested a review from a team as a code owner April 11, 2025 17:35
@aleksandernsilva aleksandernsilva added this to the 7.6.0 milestone Apr 11, 2025
@KevLehman KevLehman added the stat: QA assured Means it has been tested and approved by a company insider label Apr 11, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 11, 2025
@kody-ai
Copy link

kody-ai bot commented Apr 15, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@kodiakhq kodiakhq bot merged commit 8715b7e into develop Apr 16, 2025
49 checks passed
@kodiakhq kodiakhq bot deleted the fix/autocomplete-agent-loop branch April 16, 2025 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants