mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
fix project member query invalidations after update, query key change regression
This commit is contained in:
@@ -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 }) => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user