Skip to content

Commit 5ee1b11

Browse files
committed
fix: missing transaction after reload (#442)
* feat: add force param to featchTokenData * chore: improve documentation
1 parent 38b0ab0 commit 5ee1b11

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/sagas/tokens.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export function* fetchTokenMetadata({ tokenId }) {
243243
}
244244
}
245245

246-
export function* fetchTokenData(tokenId) {
246+
export function* fetchTokenData(tokenId, force = false) {
247247
const fetchBalanceResponse = yield call(
248248
dispatchAndWait,
249249
tokenFetchBalanceRequested(tokenId),
@@ -256,7 +256,7 @@ export function* fetchTokenData(tokenId) {
256256
);
257257
const fetchHistoryResponse = yield call(
258258
dispatchAndWait,
259-
tokenFetchHistoryRequested(tokenId),
259+
tokenFetchHistoryRequested(tokenId, force),
260260
specificTypeAndPayload(types.TOKEN_FETCH_HISTORY_SUCCESS, {
261261
tokenId,
262262
}),

src/sagas/wallet.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export function* startWallet(action) {
287287

288288
/**
289289
* This saga will load both HTR and DEFAULT_TOKEN (if they are different)
290-
* and dispatch actions to asynchronously load all registered tokens.
290+
* and dispatch actions to asynchronously load all registered tokens forcefully.
291291
*
292292
* Will throw an error if the download fails for any token.
293293
* @returns {string[]} Array of token uid
@@ -298,9 +298,12 @@ export function* loadTokens() {
298298

299299
// fetchTokenData will throw an error if the download failed, we should just
300300
// let it crash as throwing an error is the default behavior for loadTokens
301-
yield call(fetchTokenData, htrUid);
301+
yield call(fetchTokenData, htrUid, true);
302302

303303
if (customTokenUid !== htrUid) {
304+
// custom tokens doesn't need to be forced to download because its history status
305+
// will be marked as invalidated, and history will get requested the next time a user
306+
// enters the history screen.
304307
yield call(fetchTokenData, customTokenUid);
305308
}
306309

@@ -628,6 +631,7 @@ export function* onWalletReloadData() {
628631
}
629632

630633
try {
634+
// Here we force the download of tokens history
631635
const registeredTokens = yield call(loadTokens);
632636

633637
const customTokenUid = DEFAULT_TOKEN.uid;

0 commit comments

Comments
 (0)