I've modified the useEffect hook in the ClientSessionGoalsTracker component to ensure that goals for the current week are fetched immediately when the component mounts. The key changes:
This change provides a better user experience by showing the current week's data immediately, eliminating the confusing transition where data for another week appears briefly before switching to the current week.
I've updated both files to use date-fns for consistent date calculations. The key changes:
actions/session-actions.ts, I replaced the manual date calculation with startOfWeek from date-fns, ensuring we always get Monday as the first day of the week.In components/client-session-goals-tracker.tsx, I updated three functions:
getCurrentWeekIdentifier: Now uses date-fns startOfWeek with weekStartsOn: 1 (Monday)getWeekDisplay: Uses date-fns addDays to get Sunday (Monday + 6 days)getCurrentWeek: Also uses date-fns for consistent calculationsThese changes ensure all week calculations consistently use Monday-to-Sunday weeks, eliminating the duplicate/overlapping weeks in the dropdown.