Skip to content

Commit

Permalink
👌 add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan committed Jan 5, 2022
1 parent 167d3a8 commit 1d5db83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/domain/session/sessionCookieStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export function withCookieLockAccess(operations: Operations, numberOfRetries = 0
processedSession = currentSession
}
}
// call after even if session is not persisted in order to perform operations on
// up to date cookie value, the value could have been modified by another tab
operations.after?.(processedSession || currentSession)
next()
}
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/domain/session/sessionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ export function startSessionStore<TrackingType extends string>(
})
}

/**
* allows two behaviors:
* - if the session is active, synchronize the session cache without updating the session cookie
* - if the session is not active, clear the session cookie and expire the session cache
*/
function watchSession() {
withCookieLockAccess({
options,
Expand Down

0 comments on commit 1d5db83

Please sign in to comment.