Skip to content

fix(teams): always use populationInherited for population count - #5059

Merged
hamza221 merged 1 commit into
mainfrom
bug/2126/team-member-count
Feb 4, 2026
Merged

hamza221 merged 1 commit into
mainfrom
bug/2126/team-member-count

Conversation

@cristianscheid

@cristianscheid cristianscheid commented Jan 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes team population counts to show values consistently across UI.

Changes

  • Always use populationInherited instead of alternating between population (on page load) and member list length (when clicking on a team)
  • Update team population values when a member is added/removed or a team is removed
  • Parent teams are now also updated correctly when a nested team changes, reflecting the updated population accordingly

Before

before.webm

After

after.webm

Known Issue

Race condition flow

  1. Frontend calls Backend LocalController::membersAdd() -> MemberService::addMembers()
  2. MemberService::addMembers() triggers FederatedEvent which runs asynchronously
  3. Backend returns response immediately (doesn't care if updatePopulation() completed or not)
  4. Frontend receives response and calls updateCirclesPopulationCount()
  5. Frontend fetches circles from DB (in some cases updatePopulation() did not complete yet)

With this approach, sometimes users might need to reload the page to see correct counts, specifically when adding multiple members at once or when updating a team that's also nested in other teams. This happens because getCircles() is called on the frontend before updatePopulation() in the backend has actually finished executing.

Checklist

@cristianscheid cristianscheid added the 3. to review Waiting for reviews label Jan 29, 2026
@cristianscheid cristianscheid self-assigned this Jan 29, 2026
@codecov

codecov Bot commented Jan 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/store/circles.js 0.00% 13 Missing ⚠️
.../components/AppNavigation/CircleNavigationItem.vue 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@cristianscheid
cristianscheid force-pushed the bug/2126/team-member-count branch from 3e27201 to bafc3f9 Compare January 29, 2026 14:30
@cristianscheid cristianscheid added the bug Something isn't working label Jan 29, 2026
@cristianscheid cristianscheid changed the title fix(teams): always use populationInherited for population count and u… fix(teams): fix(teams): always use populationInherited for population count Jan 29, 2026
@cristianscheid cristianscheid changed the title fix(teams): fix(teams): always use populationInherited for population count fix(teams): always use populationInherited for population count Jan 29, 2026
…pdate count on population change

Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
@hamza221
hamza221 force-pushed the bug/2126/team-member-count branch from bafc3f9 to b59a6f0 Compare February 4, 2026 11:55
@hamza221

hamza221 commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

rebased to fix CI, Does it need backport ?

@cristianscheid

Copy link
Copy Markdown
Member Author

rebased to fix CI, Does it need backport ?

Thanks! Yes, I'll request the backports.

@cristianscheid

Copy link
Copy Markdown
Member Author

/backport to stable8.3

@hamza221
hamza221 merged commit 73ce4d3 into main Feb 4, 2026
67 of 68 checks passed
@hamza221
hamza221 deleted the bug/2126/team-member-count branch February 4, 2026 12:47
@cristianscheid

cristianscheid commented Feb 4, 2026 •

Copy link
Copy Markdown
Member Author

@hamza221 This PR is the frontend counterpart of this one: nextcloud/circles#2300.

On the backend side (nextcloud/circles), I’ve requested backports to stable32 and stable31. Given that, I think we can cancel the backport of this PR to stable7.3 and keep only backport for stable8.3.

Looking at https://apps.nextcloud.com/apps/contacts, if we backport this to stable7.3 (used on nextcloud/server stable30), the Circles backend changes would not be included there, which could lead to frontend errors (e.g. trying to access a key that is not returned).

The reverse is not an issue: the backend implementation is backward-compatible and preserves the existing behavior, so it won’t break the frontend on stable7.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants