Skip to content

bug(setting): Fix issue with empty session in cache.#19376

Merged
dschom merged 1 commit intomainfrom
FXA-12299
Sep 2, 2025
Merged

bug(setting): Fix issue with empty session in cache.#19376
dschom merged 1 commit intomainfrom
FXA-12299

Conversation

@dschom
Copy link
Copy Markdown
Contributor

@dschom dschom commented Aug 29, 2025

Because

  • There's no guarantee that session is in the apollo cache.
  • If there's no session in the cache we'd hit a run time error

This pull request

  • Handles the case that session is missing.
  • Creates empty string fallback for token getter
  • Creates false fallback for verified getter

Issue that this pull request solves

Closes: FXA-12299

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

I think this is okay to do. Note that sentry issue indicates this happening when users hit the ModalVerifySession dialog, and somehow there's not a session in the apollo cache. In this case, this PR works around the issue by essentially falling back to a session state that no sessionToken and is not verified. I feel like this fallback state adequately represents a lack of the session in the cache... This is not a typical state, however, so it's a little difficult to test. Not sure how users get into this scenario...

The other tricky thing about this is that there could be a session in local storage. I considered falling back to its state, but due to the mixed cache states and the fact that state in local storage could be very old, I decided not to. If the user is on the settings page, they should really have a session in the apollo cache...

Because:
- There's no guarantee that session is in the cache.
- If there's no session in the cache we'd hit a run time error

This Commit:
- Handles the case that session is missing.
- Creates empty string fallback for token getter
- Creates false fallback for verified getter
@dschom dschom requested a review from a team as a code owner August 29, 2025 21:03
@dschom dschom merged commit f962dd6 into main Sep 2, 2025
19 checks passed
@dschom dschom deleted the FXA-12299 branch September 2, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants