mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-17 20:52:14 +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 projectsHeader.click();
|
||||||
await expect(projectsHeader.locator('svg')).toBeVisible();
|
await expect(projectsHeader.locator('svg')).toBeVisible();
|
||||||
let names = await getTableRowNames(table);
|
let names = await getTableRowNames(table);
|
||||||
expect(names.indexOf('ManyProjects Client')).toBeLessThan(
|
expect(names.indexOf('ManyProjects Client')).toBeLessThan(names.indexOf('NoProjects Client'));
|
||||||
names.indexOf('NoProjects Client')
|
|
||||||
);
|
|
||||||
|
|
||||||
// Second click toggles to asc (least projects first)
|
// Second click toggles to asc (least projects first)
|
||||||
await projectsHeader.click();
|
await projectsHeader.click();
|
||||||
names = await getTableRowNames(table);
|
names = await getTableRowNames(table);
|
||||||
expect(names.indexOf('NoProjects Client')).toBeLessThan(
|
expect(names.indexOf('NoProjects Client')).toBeLessThan(names.indexOf('ManyProjects Client'));
|
||||||
names.indexOf('ManyProjects Client')
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('test that client sort state persists after page reload', async ({ page }) => {
|
test('test that client sort state persists after page reload', async ({ page }) => {
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ const columns = computed(() => [
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const descFirstColumns = new Set<SortColumn>(
|
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) {
|
function handleSort(column: SortColumn) {
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ export const useProjectMembersStore = defineStore('project-members', () => {
|
|||||||
'Project member added successfully',
|
'Project member added successfully',
|
||||||
'Failed to add project member'
|
'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) {
|
if (response?.data?.project_id) {
|
||||||
queryClient.invalidateQueries({
|
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',
|
'Project member removed successfully',
|
||||||
'Failed to remove project member'
|
'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 projectMembers = computed<ProjectMember[]>(() => query.data.value?.data ?? []);
|
||||||
|
|
||||||
const invalidateProjectMembers = () => {
|
const invalidateProjectMembers = () => {
|
||||||
queryClient.invalidateQueries({ queryKey: ['projectMembers', projectIdValue.value] });
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ['projectMembers', getCurrentOrganizationId(), projectIdValue.value],
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user