frankcollins3 / Next-Water-App

Happy, Healthy Water Cycling App that tracks user/human fluid intake.
https://next-water-app.vercel.app
1 stars 0 forks source link

separate functions | defer to performance ? [9:46am] #88

Open frankcollins3 opened 11 months ago

frankcollins3 commented 11 months ago

attempting to do: Contexts/Promises is an app.tsx wrapping that provides functions and redux changing state (since .ts cant: usehooks cant be called in that function) this issue bookmarks a question about how to go about this in the most sensible way.

error: // no errors both approaches will work: Screen Shot 2023-07-23 at 9 46 07 AM pictured above, i've already commented out: SET_HYDRO_DATA && SET_DATE (I believe /dashboard needs this data and that won't hurt anything to set those useless states when returning the getDailyData) but would still like to separate.

| split | decisions | : I now want to make a Promise that takes all boolean params for possible data to set. this will reduce the redundancy of calling the same getDailyData promise (which is already redis cached so somewhat performant) the question is whether this intrudes upon "single responsibility" as this function will essentially be performing multiple tasks.

but will it be? these next few promises will take that same getDailyDataPROMISE() return data which is prisma.data.findMany() (or redis cache of same)

and SET_REDUX_STATE.

in this case, the data will be called once per page (/index.tsx && /dashboard.tsx) and sounds more like it makes sense