Skip to content

Commit

Permalink
history: fix auto reload run even when no new wallet or transact
Browse files Browse the repository at this point in the history
  • Loading branch information
HpT2 committed Jun 6, 2024
1 parent db39d75 commit dd3618e
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/Screens/History/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const TransactionRecord = ({data, wallets, setModTransactID} : {data : Transacti
let getWalletName = (id : string) => {
if(wallets.length >0 ){
let index : number = wallets.findIndex((wallet) => wallet.id == id);
return wallets[index].name;
return wallets[index] ? wallets[index].name : 'deleted wallet';
}
return "Waiting";

Expand Down Expand Up @@ -359,23 +359,14 @@ export const History = ({route} : {route : any}) => {
useFocusEffect(
useCallback(() => {
//console.log(route.params)


if(firstLoad){
if(startDate.toDateString() != (new Date(-1)).toDateString()) fetchWithCond();
else changeDefaultRange(3);
getWallet();
setFirstLoad(false);
newDataComing.newTransact = false;
newDataComing.newWallet = false;

}

if(!firstLoad && newDataComing.newWallet) {
console.log(newDataComing.newTransact, newDataComing.newWallet, firstLoad);
if(newDataComing.newWallet) {
getWallet();
newDataComing.newWallet = false;
}
if(!firstLoad && newDataComing.newTransact) {
if(newDataComing.newTransact) {
if(startDate.toDateString() != (new Date(-1)).toDateString()) fetchWithCond();
else changeDefaultRange(3);
fetchData(startDate, endDate);
console.log(newDataComing.newTransact);
newDataComing.newTransact = false;
Expand Down

0 comments on commit dd3618e

Please sign in to comment.