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

Users: dedupe user count #99448

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Users: dedupe user count #99448

wants to merge 1 commit into from

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Feb 7, 2025

Proposed Changes

This commit uses the length of the deduped users rather than the undeduped length in the users query. It ensures that the count is correctly displayed on the Users page.

Before

Screenshot 2025-02-07 at 12 06 46 pm

After

Screenshot 2025-02-07 at 12 12 30 pm

Why are these changes being made?

The list of users is already deduped, but the count is not. This creates a mismatch between the number of users returned in the list and the count.

I suspect it was an oversight in https://github.com/Automattic/wp-calypso/pull/50712/files#diff-d3b37aa7f029b8f881e02a9ea0d701be351599baeab1900624a99512954a6cceR43

I think the deduping should happen at the source: Related endpoint changes: Automattic/jetpack#28317 (comment)

Testing Instructions

  1. Fire up this branch and head over to /people/team/[YOUR_SITE]
  2. Invite a new user, e.g., Editor. Accept that invite.
  3. Refresh /people/team/[YOUR_SITE] and check that the "You have n team members" contains the correct count.
  4. Now invite a Viewer. Accept.
  5. Refresh /people/team/[YOUR_SITE] and check that the "You have n team members" contains the correct count. (Invites are not counted)
  6. Now invite that same Viewer from 4 again but give them a role of Editor or Author. Accept that invite.
  7. Refresh /people/team/[YOUR_SITE] and check that the "You have n team members" contains the correct count.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

…duped length in the users query. It ensures that the count is correctly displayed.
@ramonjd ramonjd added [Type] Bug When a feature is broken and / or not performing as intended [Pri] Low Address when resources are available. [Feature] User Management Tools for managing site users, their roles, and permissions. labels Feb 7, 2025
@ramonjd ramonjd self-assigned this Feb 7, 2025
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Feb 7, 2025
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~62 bytes added 📈 [gzipped])

name                     parsed_size           gzip_size
site-settings                  +45 B  (+0.0%)      +11 B  (+0.0%)
site-marketing                 +45 B  (+0.0%)      +12 B  (+0.0%)
settings                       +45 B  (+0.0%)      +11 B  (+0.0%)
people                         +45 B  (+0.0%)       +8 B  (+0.0%)
marketing                      +45 B  (+0.0%)      +12 B  (+0.0%)
jetpack-social                 +45 B  (+0.0%)      +12 B  (+0.0%)
import-hosted-site-flow        +45 B  (+0.0%)       +8 B  (+0.0%)
import                         +45 B  (+0.0%)       +7 B  (+0.0%)
hosting                        +45 B  (+0.0%)      +11 B  (+0.0%)
email                          +45 B  (+0.0%)       +7 B  (+0.0%)
domains                        +45 B  (+0.0%)       +9 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~13 bytes added 📈 [gzipped])

name                      parsed_size           gzip_size
async-load-design-blocks        +45 B  (+0.0%)      +13 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] User Management Tools for managing site users, their roles, and permissions. [Pri] Low Address when resources are available. [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants