fix: invalidate queries better
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user