Skip to content

Commit 86b7b35

Browse files
invalidate query
1 parent cc763bf commit 86b7b35

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

apps/dashboard/src/app/team/[team_slug]/[project_slug]/engine/analytics/analytics-page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function TransactionsAnalyticsPageContent(props: {
3636
/>
3737
<SendTestTransaction
3838
wallets={props.wallets}
39+
clientId={props.clientId}
3940
expanded={props.expandTestTx}
4041
/>
4142
<TransactionsTable

apps/dashboard/src/app/team/[team_slug]/[project_slug]/engine/analytics/send-test-tx.client.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { THIRDWEB_ENGINE_CLOUD_URL } from "@/constants/env";
1212
import { useThirdwebClient } from "@/constants/thirdweb.client";
1313
import { zodResolver } from "@hookform/resolvers/zod";
14-
import { useMutation } from "@tanstack/react-query";
14+
import { useMutation, useQueryClient } from "@tanstack/react-query";
1515
import { ChevronDown, Loader2, LockIcon } from "lucide-react";
1616
import { useState } from "react";
1717
import { useForm } from "react-hook-form";
@@ -33,10 +33,12 @@ type FormValues = z.infer<typeof formSchema>;
3333

3434
export function SendTestTransaction(props: {
3535
wallets?: Wallet[];
36+
clientId: string;
3637
expanded?: boolean;
3738
}) {
3839
const [isOpen, setIsOpen] = useState(props.expanded ?? false);
3940
const thirdwebClient = useThirdwebClient();
41+
const queryClient = useQueryClient();
4042

4143
const form = useForm<FormValues>({
4244
resolver: zodResolver(formSchema),
@@ -103,12 +105,15 @@ export function SendTestTransaction(props: {
103105
return null;
104106
}
105107

106-
const onSubmit = (data: FormValues) => {
107-
sendDummyTxMutation.mutate({
108+
const onSubmit = async (data: FormValues) => {
109+
await sendDummyTxMutation.mutateAsync({
108110
walletAddress: selectedWallet.address,
109111
accessToken: data.accessToken,
110112
chainId: data.chainId,
111113
});
114+
queryClient.invalidateQueries({
115+
queryKey: ["transactions", props.clientId],
116+
});
112117
};
113118

114119
return (

0 commit comments

Comments
 (0)