Skip to content

Commit 3639853

Browse files
j0ntzJon Tzeng
authored andcommitted
Fix sender-side name persistence
There was an issue where the name shows in the scene immediately after broadcast, but gets lost when revisiting the tx in the history.
1 parent d16b9e8 commit 3639853

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/components/scenes/SendScene2.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,27 @@ const SendComponent = (props: Props): React.ReactElement => {
14151415

14161416
await coreWallet.saveTx(broadcastedTx)
14171417

1418+
// edge-core-js's saveTx silently drops tx.metadata when the engine
1419+
// has already registered the txid in walletState before we get here
1420+
// (race against the engine's onTransactionsChanged callback, which
1421+
// calls setupNewTxMetadata with no metadata for the engine's view of
1422+
// the tx). Re-apply via saveTxMetadata so payeeName and fio notes
1423+
// survive a reload from disk.
1424+
if (payeeName != null) {
1425+
await coreWallet
1426+
.saveTxMetadata({
1427+
txid: broadcastedTx.txid,
1428+
tokenId: broadcastedTx.tokenId,
1429+
metadata: {
1430+
name: broadcastedTx.metadata.name,
1431+
notes: broadcastedTx.metadata.notes
1432+
}
1433+
})
1434+
.catch((error: unknown) => {
1435+
showError(error)
1436+
})
1437+
}
1438+
14181439
for (const target of spendInfo.spendTargets) {
14191440
// Write FIO OBT per spendTarget
14201441
await recordFioObtData(

0 commit comments

Comments
 (0)