Skip to content

Conversation

@ulemons
Copy link
Contributor

@ulemons ulemons commented Jan 28, 2026

Fix Members List and Cache Invalidation Issues

Overview

This PR addresses several critical issues with the members list functionality, specifically around member attribute updates and cache synchronization.

Issues Fixed

1. Members Query Filters

  • Problem: Filters were not correctly retrieving member data, causing incomplete information to be displayed
  • Solution: Fixed query filters to properly fetch all required member attributes and data

2. Cache Invalidation

  • Problem: After updating member attributes (mark as bot, mark as team member), the UI wasn't immediately reflecting changes, requiring manual refresh or repeated operations
  • Solution: Implemented comprehensive cache invalidation strategy for both dropdown menu actions and bulk table operations
    • Added coordinated cache invalidation using TanStack Query
    • Implemented proper timing with delays to ensure cache updates are processed
    • Added cache reset functionality for complete data refresh

3. Bulk "Mark as Bot" Feature

  • Problem: The bulk operations in table view were missing the "mark as bot" functionality
  • Solution: Added bulk "mark as bot" and "unmark as bot" options to the table toolbar dropdown

Important Note - Backend API Limitation

⚠️ Known Issue: The backend API currently returns only a limited set of attributes (4 out of 8+) for performance optimization reasons. This means that when we refetch member data after updates, some attribute information may be lost.


Note

Adds bulk "Mark as bot" to the members list and makes attribute updates safe while ensuring the UI refreshes correctly.

  • New bulk action in member-list-toolbar.vue: markAsBot (with toggle copy/icon), event tracking, and handler doMarkAsBot
  • Refactors bulk/team-member updates to first fetch full member data via MemberService.find(..., includeAllAttributes=true) and merge before update to prevent attribute loss
  • Adds cache refresh helpers (invalidateMemberCache) for bulk toolbar and per-member dropdown; triggers fetchMembers({ reload: true })
  • Backend/data layer: extends MemberService.find and DAL queryMembersAdvanced/executeQuery with includeAllAttributes; default returns minimal attributes, optional flag includes additional fields (e.g., bio, company, websiteUrl)
  • Member list page: uses transformed filters for savedFilterBody and orderBy, and improves query keys/invalidation when project group or filters change

Written by Cursor Bugbot for commit 7a3d524. This will update automatically on new commits. Configure here.

@ulemons ulemons self-assigned this Jan 28, 2026
@ulemons ulemons added the Feature Created by Linear-GitHub Sync label Jan 28, 2026
@ulemons ulemons changed the title feat: add mark as bot, and reload page after feat: add mark as bot, and reload page after (CM-908) Jan 28, 2026
@ulemons ulemons requested a review from joanagmaia January 28, 2026 14:44
@ulemons ulemons marked this pull request as ready for review January 28, 2026 14:45
Comment on lines 118 to 136
const invalidateMemberCache = async () => {
const invalidatePromises = [
// Invalidate all members list queries
queryClient.invalidateQueries({
queryKey: [TanstackKey.MEMBERS_LIST],
refetchType: 'all',
}),
// Reset all member-related queries to force complete refetch
queryClient.resetQueries({
queryKey: [TanstackKey.MEMBERS_LIST],
}),
];

await Promise.all(invalidatePromises);

// Add delay to ensure React Query invalidation is fully processed
setTimeout(() => {
fetchMembers({ reload: true });
}, 200);
Copy link
Contributor

Choose a reason for hiding this comment

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

This method seems a bit redundant. It's calling 3 different methods to achieve more a less the same thing.
For invalidateQueries:

  • When a query is invalidated with invalidateQueries, two things happen:
    • It is marked as stale. This stale state overrides any staleTime configurations being used in useQuery or related hooks
    • If the query is currently being rendered via useQuery or related hooks, it will also be refetched in the background

For resetQueries:

  • The resetQueries method can be used to reset queries in the cache to their initial state based on their query keys or any other functionally accessible property/state of the query.

For fetchMembers:
It will just trigger a new fetch of members with a full reload.

I would say that we can simplify by only having, either the invalidateQueries or the fetchMembers with full reload. Did you try this option?

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@ulemons ulemons marked this pull request as draft January 28, 2026 16:57
@ulemons ulemons closed this Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants