fix project member query invalidations after update, query key change regression

This commit is contained in:
Gregor Vostrak
2026-02-18 18:51:21 +01:00
parent 26524c5f40
commit 864f41bda6
4 changed files with 15 additions and 11 deletions

View File

@@ -190,16 +190,12 @@ test('test that sorting clients by project count works', async ({ page, ctx }) =
await projectsHeader.click();
await expect(projectsHeader.locator('svg')).toBeVisible();
let names = await getTableRowNames(table);
expect(names.indexOf('ManyProjects Client')).toBeLessThan(
names.indexOf('NoProjects Client')
);
expect(names.indexOf('ManyProjects Client')).toBeLessThan(names.indexOf('NoProjects Client'));
// Second click toggles to asc (least projects first)
await projectsHeader.click();
names = await getTableRowNames(table);
expect(names.indexOf('NoProjects Client')).toBeLessThan(
names.indexOf('ManyProjects Client')
);
expect(names.indexOf('NoProjects Client')).toBeLessThan(names.indexOf('ManyProjects Client'));
});
test('test that client sort state persists after page reload', async ({ page }) => {

View File

@@ -67,7 +67,9 @@ const columns = computed(() => [
]);
const descFirstColumns = new Set<SortColumn>(
columns.value.filter((c) => 'sortDescFirst' in c && c.sortDescFirst).map((c) => c.id as SortColumn)
columns.value
.filter((c) => 'sortDescFirst' in c && c.sortDescFirst)
.map((c) => c.id as SortColumn)
);
function handleSort(column: SortColumn) {

View File

@@ -26,7 +26,9 @@ export const useProjectMembersStore = defineStore('project-members', () => {
'Project member added successfully',
'Failed to add project member'
);
queryClient.invalidateQueries({ queryKey: ['projectMembers', projectId] });
queryClient.invalidateQueries({
queryKey: ['projectMembers', organization, projectId],
});
}
}
@@ -49,7 +51,7 @@ export const useProjectMembersStore = defineStore('project-members', () => {
);
if (response?.data?.project_id) {
queryClient.invalidateQueries({
queryKey: ['projectMembers', response.data.project_id],
queryKey: ['projectMembers', organization, response.data.project_id],
});
}
}
@@ -69,7 +71,9 @@ export const useProjectMembersStore = defineStore('project-members', () => {
'Project member removed successfully',
'Failed to remove project member'
);
queryClient.invalidateQueries({ queryKey: ['projectMembers', projectId] });
queryClient.invalidateQueries({
queryKey: ['projectMembers', organizationId, projectId],
});
}
}

View File

@@ -32,7 +32,9 @@ export function useProjectMembersQuery(projectId: Ref<string | null> | string) {
const projectMembers = computed<ProjectMember[]>(() => query.data.value?.data ?? []);
const invalidateProjectMembers = () => {
queryClient.invalidateQueries({ queryKey: ['projectMembers', projectIdValue.value] });
queryClient.invalidateQueries({
queryKey: ['projectMembers', getCurrentOrganizationId(), projectIdValue.value],
});
};
return {