Repository navigation
Delete only the expired eligibility cache entry instead of clearing sessionStorage - #426
Merged
greg-olivier merged 3 commits intoDec 2, 2026
Conversation
|
👌 Chromatic found no visual changes to review. |
…ring sessionStorage Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
greg-olivier
force-pushed
the
feature/mp-323-rb-6-stop-wiping-the-merchants-sessionstorage
branch
from
December 2, 2026 11:21
1444af9 to
92fbe1b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
When the eligibility cache entry for a widget is older than one hour, the widget used to call
sessionStorage.clear(). That deleted every key the merchant keeps on the page, such as cart, checkout and analytics data. It also sent no request, so the widget stayed on its loader until the nextadd().Now an expired entry is deleted on its own, and the request goes out as for a cache miss. The widget shows its plans after one request. The widget never calls
sessionStorage.clear(), andclearCache()is removed.A corrupt entry is handled the same way. If the stored text is not valid JSON, or its
valueis not an array, the entry is deleted and the widget fetches again. Before, both cases made the widget fail with a warning and show nothing, until the entry expired.Commits
get-eligibility.tsinto a newreadCache(key)ineligibility-cache.ts. This commit changes no behaviour, except that the warnings for a failed read and a failed delete now share one message.readCachereturns the cached plans, ornullwhen the request must go out.getCache,deleteCacheandisMoreThanOneHourAgoare no longer exported. The cache tests now callreadCacheandsetCache, andget-eligibility.test.tskeeps only the cases about when a request goes out.For the reviewer
SyntaxErrorfromJSON.parsecounts as a corrupt entry. Any other storage error is rethrown and still makesgetEligibility()fail with one warning, as it did before.getEligibility()fail. The next PR in the stack changes that.Not in this PR
🤖 Generated with Claude Code