Skip to content

Commit

Permalink
fix: make lockupTransaction reactive to swap
Browse files Browse the repository at this point in the history
  • Loading branch information
jackstar12 committed Jan 8, 2025
1 parent 4b43d3c commit a40bd5d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/RefundButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Show,
Switch,
createResource,
createSignal,
createSignal, createEffect
} from "solid-js";
import { ChainSwap, SubmarineSwap } from "src/utils/swapCreator";

Expand Down Expand Up @@ -213,7 +213,7 @@ const RefundButton = (props: {
setRefundRunning(false);
};

const [lockupTransaction] = createResource(async () => {
const [lockupTransaction, {refetch: refetchLockup}] = createResource(async () => {
if (!props.swap()) {
return undefined;
}
Expand All @@ -232,6 +232,12 @@ const RefundButton = (props: {
return transactionToRefund;
});

createEffect(() => {
if(props.swap() !== undefined) {
refetchLockup(null);
}
})

const [preimageHash] = createResource(async () => {
return (await decodeInvoice((props.swap() as SubmarineSwap).invoice))
.preimageHash;
Expand Down

0 comments on commit a40bd5d

Please sign in to comment.