Closed vindennt closed 1 year ago
Rule out the AppNavigator.tsx useEffect. Removing it has no effect on whether the infinite rerenders happen.
Rule out TripBox.tsx causing this problem because its code never re-navigates to Timer.tsx. So, the infinite loop is triggering Timer.tsx's useEffect to run over and over in the background of Trip.tsx.
Removing the timeout on Timer.tsx does not stop the loop.
Skipping Timer.tsx by navigating straight from TripBox.tsx to Trip.tsx still maintains the infininte loop, so the trigger does not originate from Timer.tsx
the useEffect of the entry component AppNavigator.tsx updates both of these fields with a useEffect that also has no dependencies. However, they do not trigger an infinite loop, even when the changes occur asynchronously while the homescreen is rendered. So, could starting a trip change the app into a state where it becomes vulnerable to the infinite rerenders
Problem found: dailyResetTime and last_focus_date being updated would cause the AppNavigator wrapper to constantly rerender, causing the entire navigation stack to rerender and for all their useEffects to trigger. This explains why Timer.tsx's useEffect would trigger during the infinite loop even when it had no direct role in Trip.tsx's script.
Temp Code solution: disable these two variables from being loaded on the AppNavigator.
Problem resolved as of 3a00d8c
Solution was to let the missions page itself handle keeping these two variables in state.
what are your pronouns?
what are your pronouns? 68 65 2F 68 69 6D
when sending a reqeust such as
update: { balance: balance + rewards.total, slider: slider, total_trip_time: total_trip_time + slider, total_trips_finished: total_trips_finished + 1, last_used_station: trip[0], daily_focus_time: datesMatch(today, last_focus_date) ? dailyFocusTime + slider : slider, // last_focus_date: today, // daily_reset_time: today, }, The two last properties will cause infinite loops of the useEffect on Trip.tsx if any singular one is enabled. Questionable because the Trip.tsx screen has no dependencies, nor states that its useEffect relies on. Same goes for the code on Timer.tsx, which is from the previous screen too and has already been navigated away from. Timer.tsx should have no running code once it naviagtes away from itself. None of its front end components rely on states that might be changed with these two lines.