From 595a5d068da15e52875385c4f33b74142d3a9c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ti=E1=BA=BFn=20Nguy=E1=BB=85n=20Kh=E1=BA=AFc?= Date: Sun, 8 Dec 2024 01:47:56 +1300 Subject: [PATCH] refactor!: nest tx options --- .changeset/green-mayflies-dance.md | 5 +++++ packages/react/src/hooks/use-mutation.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/green-mayflies-dance.md diff --git a/.changeset/green-mayflies-dance.md b/.changeset/green-mayflies-dance.md new file mode 100644 index 00000000..322e94c6 --- /dev/null +++ b/.changeset/green-mayflies-dance.md @@ -0,0 +1,5 @@ +--- +"@reactive-dot/react": minor +--- + +BREAKING: nested tx options to avoid possible property clash. diff --git a/packages/react/src/hooks/use-mutation.ts b/packages/react/src/hooks/use-mutation.ts index ac093bf2..37444b4c 100644 --- a/packages/react/src/hooks/use-mutation.ts +++ b/packages/react/src/hooks/use-mutation.ts @@ -65,8 +65,9 @@ export function useMutation< ( get, _set, - submitOptions?: TxOptions> & { + submitOptions?: { signer?: PolkadotSigner; + txOptions?: TxOptions>; }, ) => { const signer = @@ -87,7 +88,10 @@ export function useMutation< mutationEventSubject.next({ ...eventProps, value: pending }); return transaction - .signSubmitAndWatch(signer, submitOptions ?? options?.txOptions) + .signSubmitAndWatch( + signer, + submitOptions?.txOptions ?? options?.txOptions, + ) .pipe( tap((value) => mutationEventSubject.next({ ...eventProps, value }),