Skip to content

Commit

Permalink
refactor!: nest tx options (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
tien authored Dec 7, 2024
1 parent 8550dd1 commit 8ca10b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-mayflies-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reactive-dot/react": minor
---

BREAKING: nested tx options to avoid possible property clash.
8 changes: 6 additions & 2 deletions packages/react/src/hooks/use-mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export function useMutation<
(
get,
_set,
submitOptions?: TxOptions<ReturnType<TAction>> & {
submitOptions?: {
signer?: PolkadotSigner;
txOptions?: TxOptions<ReturnType<TAction>>;
},
) => {
const signer =
Expand All @@ -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 }),
Expand Down

0 comments on commit 8ca10b3

Please sign in to comment.