Conversation
This would provide a better interface for the session. We can use setters to save to storage when we update the session.
36b4e18 to
7af23d0
Compare
| return new Session( | ||
| JSON.parse(window.sessionStorage.getItem(REPLAY_SESSION_KEY)), | ||
| { stickySession: true } | ||
| ); |
There was a problem hiding this comment.
If there's a saved item, we can assume stickySession is true.
There was a problem hiding this comment.
If this was localStorage instead of sessionStorage then the assumption might not hold as well. If someone is doing a deploy and changing the config for example, they might expect that the saved data gets wiped instead.
With sessionStorage I'm not worried about that because the data doesn't live nearly as long.
|
This fixes the bug where |
src/session/Session.ts
Outdated
| import { uuid4 } from '@sentry/utils'; | ||
| import { saveSession } from './saveSession'; | ||
|
|
||
| export interface SessionObject { |
There was a problem hiding this comment.
exported but I can't see any imports. Related to the toJSON method lower in this file though.
| return new Session( | ||
| JSON.parse(window.sessionStorage.getItem(REPLAY_SESSION_KEY)), | ||
| { stickySession: true } | ||
| ); |
There was a problem hiding this comment.
If this was localStorage instead of sessionStorage then the assumption might not hold as well. If someone is doing a deploy and changing the config for example, they might expect that the saved data gets wiped instead.
With sessionStorage I'm not worried about that because the data doesn't live nearly as long.
Co-authored-by: Ryan Albrecht <ryan@ryanalbrecht.ca>
This would provide a better interface for the session. This fixes/simplifies updating the session directly where previously it would not save to storage, only the session "instance" (object).
This would provide a better interface for the session. This fixes/simplifies updating the session directly where previously it would not save to storage, only the session "instance" (object).