Skip to content

Stop looking in localStorage for temporary cache#8579

Merged
tnorling merged 6 commits intodevfrom
temporary-storage-fix
May 5, 2026
Merged

Stop looking in localStorage for temporary cache#8579
tnorling merged 6 commits intodevfrom
temporary-storage-fix

Conversation

@tnorling
Copy link
Copy Markdown
Collaborator

@tnorling tnorling commented May 4, 2026

This pull request simplifies the behavior of the getTemporaryCache method in BrowserCacheManager by removing legacy fallback logic and updates the related unit tests accordingly. The main focus is to ensure that temporary cache retrieval is streamlined and no longer checks local storage for items set by old versions.

Fixes #8577

Browser cache logic simplification:

  • BrowserCacheManager.ts: Removed fallback logic in getTemporaryCache that previously checked localStorage for temporary cache items if not found in session/memory storage. The method now only checks the intended temporary cache storage. Added a trace log for method invocation.

Test updates:

  • BrowserCacheManager.spec.ts: Removed the test that verified fallback to localStorage in getTemporaryCache, as this behavior is no longer supported.

@tnorling tnorling requested a review from a team as a code owner May 4, 2026 18:56
Copilot AI review requested due to automatic review settings May 4, 2026 18:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR removes legacy localStorage fallback behavior from BrowserCacheManager.getTemporaryCache and updates tests to match the simplified retrieval path.

Changes:

  • Simplifies getTemporaryCache to read only from the configured temporary cache storage.
  • Removes the unit test that validated the legacy localStorage fallback behavior.
  • Adds a changelog entry describing the behavior change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
lib/msal-browser/src/cache/BrowserCacheManager.ts Removes the legacy fallback path from temporary cache reads and adds a trace log.
lib/msal-browser/test/cache/BrowserCacheManager.spec.ts Deletes the test that covered the removed fallback behavior.
change/@azure-msal-browser-4e066b2f-6995-49dc-8d30-fb502ab69cf9.json Records the change as a patch release note.

Comment thread lib/msal-browser/src/cache/BrowserCacheManager.ts
lalimasharda
lalimasharda previously approved these changes May 4, 2026
@tnorling tnorling enabled auto-merge (squash) May 5, 2026 16:59
@tnorling tnorling merged commit b4e498c into dev May 5, 2026
71 checks passed
@tnorling tnorling deleted the temporary-storage-fix branch May 5, 2026 17:00
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.

BrowserCacheManager fails to reset cache when BrowserCacheLocation.LocalStorage

4 participants