Skip to content

refactor: Omnichannel's tag autocompletes to useInfiniteQuery #35874

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

Merged
merged 8 commits into from
May 19, 2025

Conversation

aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Apr 24, 2025

Proposed changes (including videos or screenshots)

This PR refactors the useTagsList hook to take advantage of react query's useInfiniteQuery instead of RecordList in combination with useScrollableRecordList.

Issue(s)

CTZ-105

Steps to test or reproduce

Further comments

This change can be tested by visiting pages using tag autocompletes and confirming the expected behavior: fetching, filtering and lazy loading.

  • Current chats page

This pull request refactors the Omnichannel's tag autocomplete functionality in the Rocket.Chat repository. The main changes include:

  1. New Custom Hook: Introduces a useTagsList hook in TypeScript using @tanstack/react-query. This hook fetches and manages a paginated list of livechat tags from the /v1/livechat/tags endpoint, supporting filtering by text, department, and an option to view all tags. It also handles infinite scrolling logic.

  2. Component Refactor: Updates the AutoCompleteTagsMultiple component to use the new useTagsList hook, simplifying data fetching and pagination logic. It enhances prop handling by deriving types from the PaginatedMultiSelectFiltered component and allowing pass-through props.

  3. Department Editing Logic: Modifies the logic in the department editing form to determine unit requirements by replacing list.itemCount with list.length.

These changes aim to improve the efficiency and maintainability of the tag autocomplete feature in the Omnichannel module.

Copy link
Contributor

dionisio-bot bot commented Apr 24, 2025

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

Copy link

changeset-bot bot commented Apr 24, 2025

⚠️ No Changeset found

Latest commit: 841f8ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

kodus-ai bot commented Apr 24, 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.

Copy link
Contributor

github-actions bot commented Apr 24, 2025

PR Preview Action v1.6.1

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

Built to branch gh-pages at 2025-05-19 13:15 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link

codecov bot commented Apr 24, 2025

Codecov Report

Attention: Patch coverage is 87.83784% with 9 lines in your changes missing coverage. Please review.

Project coverage is 64.96%. Comparing base (29bf978) to head (841f8ea).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #35874      +/-   ##
===========================================
+ Coverage    64.92%   64.96%   +0.03%     
===========================================
  Files         3100     3100              
  Lines        92490    92544      +54     
  Branches     17652    17661       +9     
===========================================
+ Hits         60046    60117      +71     
+ Misses       29677    29665      -12     
+ Partials      2767     2762       -5     
Flag Coverage Δ
e2e 58.45% <88.88%> (+0.01%) ⬆️
unit 72.10% <87.32%> (+0.07%) ⬆️

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.

@aleksandernsilva aleksandernsilva force-pushed the refactor/tag-autocomplete-query branch from e5b3a29 to cf364fd Compare April 24, 2025 20:43
Copy link

kodus-ai bot commented Apr 25, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

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.

@aleksandernsilva aleksandernsilva force-pushed the refactor/tag-autocomplete-query branch from 45ba893 to a200f05 Compare April 25, 2025 17:33
@aleksandernsilva aleksandernsilva force-pushed the refactor/tag-autocomplete-query branch from a200f05 to 7c119b8 Compare May 5, 2025 16:32
Copy link

kodus-ai bot commented May 7, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

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.

@aleksandernsilva aleksandernsilva force-pushed the refactor/tag-autocomplete-query branch from 997a4bb to 553a07d Compare May 7, 2025 18:20
@aleksandernsilva aleksandernsilva marked this pull request as ready for review May 7, 2025 20:10
@aleksandernsilva aleksandernsilva requested review from a team as code owners May 7, 2025 20:10
Copy link

kodus-ai bot commented May 13, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

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.

@aleksandernsilva aleksandernsilva force-pushed the refactor/tag-autocomplete-query branch from a82c991 to c64c565 Compare May 14, 2025 19:20
tassoevan
tassoevan previously approved these changes May 15, 2025
@tassoevan tassoevan added this to the 7.7.0 milestone May 16, 2025
@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label May 19, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label May 19, 2025
Copy link
Contributor

kodiakhq bot commented May 19, 2025

This PR currently has a merge conflict. Please resolve this and then re-add the ['stat: ready to merge', 'automerge'] label.

@kodiakhq kodiakhq bot removed the stat: ready to merge PR tested and approved waiting for merge label May 19, 2025
@aleksandernsilva aleksandernsilva force-pushed the refactor/tag-autocomplete-query branch from c64c565 to 841f8ea Compare May 19, 2025 13:10
@tassoevan tassoevan merged commit 6792669 into develop May 19, 2025
54 checks passed
@tassoevan tassoevan deleted the refactor/tag-autocomplete-query branch May 19, 2025 14:34
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants