vindennt / Skytrainer

Productivity habit forming app using React Native and mobile gacha game design principles.
1 stars 0 forks source link

Trip.tsx: End of trip sequence always runs twice #6

Closed vindennt closed 1 year ago

vindennt commented 1 year ago

console logging for most methods runs twice, which means everything runs twice and is a waste of performance. Worth noting that tripRewardHandler always logs a reward of 0, suggesting the sequence runs first with an empty trip list until findViableTrips() finishes. Potential fix would be for downstream methods to not be called until findViableTrips() finishes?

vindennt commented 1 year ago

observed to sometimes run more than twice, suggesting slow asyncs arriving all at once are causing rerenders, which recall the functions to getRewards again and again. Solution: try useMemo and useCallback to avoid recalling the function

vindennt commented 1 year ago

no longer issue after redux refactorization