Skip to content

Commit

Permalink
Set lastCryptoSent when sending a tip rather than upon completion (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Oct 3, 2023
1 parent d904e43 commit 271f3dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 1 addition & 4 deletions frontend/app/src/components/home/ChatMessage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
$: communityMembers = client.currentCommunityMembers;
$: senderDisplayName = client.getDisplayName(sender, $communityMembers);
$: messageContext = { chatId, threadRootMessageIndex };
$: lastCryptoSent = client.lastCryptoSent;
$: tips = msg.tips ? Object.entries(msg.tips) : [];
afterUpdate(() => {
Expand Down Expand Up @@ -356,9 +355,7 @@
const transfer = ev.detail;
const currentTip = (msg.tips[transfer.ledger] ?? {})[client.user.userId] ?? 0n;
client.tipMessage(messageContext, msg.messageId, transfer, currentTip).then((resp) => {
if (resp.kind === "success") {
lastCryptoSent.set(transfer.ledger);
} else {
if (resp.kind !== "success") {
toastStore.showFailureToast("tip.failure");
}
});
Expand Down
2 changes: 2 additions & 0 deletions frontend/app/src/components/home/TipBuilder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
let dollarScale = tweened(0);
let centAmount = 0;
$: lastCryptoSent = client.lastCryptoSent;
$: cryptoBalanceStore = client.cryptoBalance;
$: cryptoLookup = client.cryptoLookup;
$: cryptoBalance = $cryptoBalanceStore[ledger] ?? BigInt(0);
Expand Down Expand Up @@ -84,6 +85,7 @@
createdAtNanos: BigInt(Date.now()) * BigInt(1_000_000),
};
dispatch("send", transfer);
lastCryptoSent.set(ledger);
}
function cancel() {
Expand Down

0 comments on commit 271f3dd

Please sign in to comment.