Skip to content

Commit fb8e3c1

Browse files
committed
Use default value for getting BALANCE_FETCH_TIME from localStorage
Previously, it returned undefined if there was no value present in localStorage. This was converted to NaN by Number() which the following lines didn't account for. This fixes balances not being fetched if opening the project for the first time.
1 parent 1c3a4b3 commit fb8e3c1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const App: FunctionComponent = () => {
2727
useEffect(() => {
2828
const fetchInitialData = async () => {
2929
const fetchAfterTime = new Date().getTime() - 5 * 60 * 1000; // five minutes ago
30-
const balanceFetchTime = Number(getFromLocalStorage(LocalStorageKey.BALANCE_FETCH_TIME));
30+
const balanceFetchTime = Number(getFromLocalStorage(LocalStorageKey.BALANCE_FETCH_TIME, "0"));
3131

3232
if (balanceFetchTime === 0 || fetchAfterTime > balanceFetchTime) {
3333
try {

0 commit comments

Comments
 (0)