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: Blank selected department when selecting out of range #33386

Merged
merged 13 commits into from
Oct 9, 2024

Conversation

rique223
Copy link
Contributor

@rique223 rique223 commented Sep 27, 2024

Proposed changes (including videos or screenshots)

The Omnichannel current chats departments filter uses "on scroll" pagination (it fetches a list of the 25 first departments and loads more items every 25 items that the user scrolls down). If a user selects a department that isn’t within the first 25 departments listed, the selection will appear blank after refreshing the page. This happens because the PaginatedSelectFiltered component cannot find the selected department in the paginated options list due to it not being part of the initially fetched list of departments. This PR adds a "normalization" function to the listing of departments that will add the missing department to the initial list so the component can correctly show the previously selected department.

Before:
oc-departments-before

After:
oc-departments-after

Issue(s)

Steps to test or reproduce

Further comments

Jira task: SUP-675

The the Oc current chats departments filter uses "on scroll" pagination. If a user selects a department that isn’t within the first 25 departments listed, the selection will appear blank after refreshing the page. This happens because the `PaginatedSelectFiltered` component cannot find the selected department in the paginated options list due to it not being part of the initially fetched list of departments.
Copy link
Contributor

dionisio-bot bot commented Sep 27, 2024

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

Copy link

changeset-bot bot commented Sep 27, 2024

🦋 Changeset detected

Latest commit: e5d5157

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

This PR includes changesets to release 33 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/core-typings Minor
@rocket.chat/rest-typings Minor
@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 Major
@rocket.chat/gazzodown Major
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Major
@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/network-broker Patch
@rocket.chat/models Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-video-conf Major
@rocket.chat/web-ui-registration Major
@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

Copy link
Contributor

github-actions bot commented Sep 27, 2024

PR Preview Action v1.4.8
Preview removed because the pull request was closed.
2024-10-09 16:58 UTC

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.59%. Comparing base (5f9826b) to head (e5d5157).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #33386   +/-   ##
========================================
  Coverage    58.58%   58.59%           
========================================
  Files         2737     2737           
  Lines        65677    65714   +37     
  Branches     14824    14826    +2     
========================================
+ Hits         38478    38505   +27     
- Misses       24420    24430   +10     
  Partials      2779     2779           
Flag Coverage Δ
unit 75.66% <ø> (ø)

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

@rique223 rique223 marked this pull request as ready for review September 30, 2024 14:38
@rique223 rique223 requested a review from a team as a code owner September 30, 2024 14:38
Copy link
Contributor

@KevLehman KevLehman left a comment

Choose a reason for hiding this comment

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

Can we add a couple of e2e tests?

…2e tests

Added tests to verify when the useDepartmentsList function should normalize the departments list for the current chats department filter. Also added an end-to-end test to validate the use of localStorage in the department filter.
@rique223
Copy link
Contributor Author

rique223 commented Oct 1, 2024

Can we add a couple of e2e tests?

Hey @KevLehman, talking to the frontend folks we concluded that it would be better to test this specific behavior through unit tests of the useDepartmentLists hook so I've added the new unit tests and also added a new test to verify the localStorage usage of the departments filter.

KevLehman
KevLehman previously approved these changes Oct 2, 2024
Copy link
Contributor

@KevLehman KevLehman left a comment

Choose a reason for hiding this comment

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

I'll remove the omni review 🤗

@rique223 rique223 requested a review from KevLehman October 4, 2024 13:19
@rique223 rique223 added this to the 6.14 milestone Oct 4, 2024
KevLehman
KevLehman previously approved these changes Oct 7, 2024
@rique223 rique223 removed the request for review from KevLehman October 9, 2024 14:53
@rique223 rique223 added the stat: QA assured Means it has been tested and approved by a company insider label Oct 9, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 9, 2024
@kodiakhq kodiakhq bot merged commit 678faed into develop Oct 9, 2024
50 checks passed
@kodiakhq kodiakhq bot deleted the fix/oc-departments-filter branch October 9, 2024 16:58
@ggazzo ggazzo modified the milestones: 6.14, 7.0 Oct 17, 2024
This was referenced Oct 20, 2024
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