fix: invalidate queries better

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-02-27 09:37:29 +01:00
parent 8db5905fb5
commit 8b18b86deb
4 changed files with 12 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ export default function AddDashboard() {
toast('Success', {
description: 'Dashboard created.',
});
queryClient.invalidateQueries(trpc.dashboard.pathFilter());
queryClient.invalidateQueries(trpc.dashboard.list.pathFilter());
popModal();
},
onError: handleError,

View File

@@ -56,6 +56,7 @@ export default function SaveReport({
projectId,
}),
);
queryClient.invalidateQueries(trpc.dashboard.list.pathFilter());
const goToReport = () => {
router.navigate({
@@ -157,6 +158,7 @@ function SelectDashboard({
projectId: string;
}) {
const trpc = useTRPC();
const queryClient = useQueryClient();
const [isCreatingNew, setIsCreatingNew] = useState(false);
const [newDashboardName, setNewDashboardName] = useState('');
@@ -177,6 +179,7 @@ function SelectDashboard({
trpc.dashboard.create.mutationOptions({
onError: handleError,
async onSuccess(res) {
queryClient.invalidateQueries(trpc.dashboard.list.pathFilter());
await dashboardQuery.refetch();
onChange(res.id);
setIsCreatingNew(false);