GabrielJDavila / NewFitnessJournal

Create exercises, log workouts, and crush your goals!
0 stars 0 forks source link

Optimize Read/Writes to DB #59

Open GabrielJDavila opened 2 weeks ago

GabrielJDavila commented 2 weeks ago

I'm having too many read and writes to firestore in a given workout. I think the best way to optimize this is:

GabrielJDavila commented 1 week ago

Some notes:

GabrielJDavila commented 2 days ago

Notes: Local storage definitely is faster, but a problem is that the same data persists even if I change dates. I need to add a date property to the data. Or, I could: initially save workout data to firestore when user is picking their exercises. When that data is initially pulled from firestore, save it to localStorage. Modify that data in localStorage (sets/Reps, notes, etc.) When the user finally saves the workout, then the data is sent back to firestore. If the user adds a new exercise, check to see if the localStorage item exists; if it does, then add the exercise. If it doesn't, add it to firestore first to initalize a new workout.