fix: invalidate queries better
This commit is contained in:
@@ -44,6 +44,9 @@ export default function AddClient() {
|
||||
queryClient.invalidateQueries(
|
||||
trpc.project.getProjectWithClients.pathFilter(),
|
||||
);
|
||||
queryClient.invalidateQueries(
|
||||
trpc.client.list.queryFilter({ projectId }),
|
||||
);
|
||||
},
|
||||
onError: handleError,
|
||||
}),
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useTRPC } from '@/integrations/trpc/react';
|
||||
import { handleError } from '@/integrations/trpc/react';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { zOnboardingProject } from '@openpanel/validation';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useNavigate } from '@tanstack/react-router';
|
||||
import {
|
||||
MonitorIcon,
|
||||
@@ -45,10 +45,14 @@ export default function AddProject() {
|
||||
},
|
||||
});
|
||||
const trpc = useTRPC();
|
||||
const queryClient = useQueryClient();
|
||||
const mutation = useMutation(
|
||||
trpc.project.create.mutationOptions({
|
||||
onError: handleError,
|
||||
onSuccess: (res) => {
|
||||
queryClient.invalidateQueries(
|
||||
trpc.project.list.queryFilter({ organizationId }),
|
||||
);
|
||||
toast.success('Project created', {
|
||||
description: `${res.name}`,
|
||||
action: {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use client';
|
||||
|
||||
import { InputWithLabel } from '@/components/forms/input-with-label';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ComboboxAdvanced } from '@/components/ui/combobox-advanced';
|
||||
|
||||
Reference in New Issue
Block a user