File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,17 +11,17 @@ import { AuthProvider } from 'src/providers/AuthProvider'
1111import { Header } from './Header'
1212
1313export const AppLayout = ( ) => {
14- const { isAuthModalOpen, setStreak, shouldCountStreak } = useAuth ( )
14+ const { isAuthModalOpen, setStreak, shouldIcrementStreak } = useAuth ( )
1515 const postStreakMutation = usePostStreak ( )
1616
1717 useEffect ( ( ) => {
18- if ( shouldCountStreak ( ) ) {
18+ if ( shouldIcrementStreak ( ) ) {
1919 postStreakMutation . mutateAsync ( undefined ) . then ( ( data ) => {
2020 setStreak ( data . streak )
2121 identifyUserStreak ( data . streak )
2222 } )
2323 }
24- } , [ shouldCountStreak ] )
24+ } , [ ] )
2525
2626 return (
2727 < AuthProvider >
Original file line number Diff line number Diff line change @@ -10,14 +10,14 @@ export const useAuth = () => {
1010
1111 const isConnected = authStore . user != null
1212
13- const shouldCountStreak = useCallback ( ( ) => {
13+ const shouldIcrementStreak = useCallback ( ( ) => {
1414 if ( ! isConnected ) return false
1515
1616 const last = authStore . lastStreakUpdate
1717 if ( ! last ) return true
1818
19- const today = new Date ( ) . toDateString ( )
20- const lastDay = new Date ( last ) . toDateString ( )
19+ const today = new Date ( ) . toISOString ( )
20+ const lastDay = new Date ( last ) . toISOString ( )
2121
2222 return today !== lastDay
2323 } , [ isConnected , authStore . lastStreakUpdate ] )
@@ -33,7 +33,7 @@ export const useAuth = () => {
3333 ...authModalStore ,
3434 ...authStore ,
3535 isConnected,
36- shouldCountStreak ,
36+ shouldIcrementStreak ,
3737 logout,
3838 }
3939}
You can’t perform that action at this time.
0 commit comments