jakji93 / airon-fitness

AIRON Fitness is an AI-powered fitness companion supporting your personal health journey by delivering customized fitness and meal plans tailored to your goals and preferences.
https://airon-fitness.onrender.com/
MIT License
4 stars 2 forks source link

Fix spinner stuck on page refresh bug #130

Closed kevin-wu01 closed 1 year ago

kevin-wu01 commented 1 year ago

Bug

When a user regenerates their schedules and refreshes the page, it causes the user to become stuck on the spinner until the schedules finish generating. This bug is present on both the home and guided workout pages.

Fix

The soln I currently have is a bit crude due to the fact that await dispatch(getWorkoutAndMealSchedule()) will not resolve until the schedules finish generating. Therefore, it's difficult to tell if the get request is taking long or if a generation is in progress without making more significant changes. I added a timeout of 1.5 seconds, if it elapses the assumption is made that a generation is in-progress.

We could remove the home page spinner, though the bug would still be present on the guided workout page and we would have to also remove/fix the home page animation as it breaks visually without it. Open to any additional thoughts.

Bug 2

When a user generates a new schedule or edits an existing schedule, a blank space will be shown in place of a tile. this looks weird visually as the first page can have less than 6 tiles while the other pages will have 6 tiles.

Fix

added a placeholder tile when a generation is ongoing

kevin-wu01 commented 1 year ago

thoughts on if 2s is enough? i added 500ms