fix(networkcache): bugfix for network cache and the way it handles st…#1466
Merged
Conversation
…oring large objects also added a way to disable the beacon for recommendationInstantiators
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Snap client network cache to better handle large cached objects, adds a config option to keep caching in-memory only (skipping sessionStorage), and exposes a beacon-disable setting for recommendation instantiators.
Changes:
- Add
memoryOnlysupport toNetworkCacheto optionally bypasssessionStorage, and improvemaxSizehandling for oversized cache entries. - Introduce a shared
beaconsettings type and allowRecommendationInstantiatorconfigs to pass beacon settings through to controllers. - Update the preact demo Email recommendations to pass the controller into
Result.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/snap-store-mobx/src/types.ts | Extracts beacon config into a reusable exported type for store/controller configs. |
| packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx | Adds beacon to the instantiator config typing so it can be forwarded into controller config. |
| packages/snap-preact-demo/src/components/Recommendations/Email/Email.tsx | Passes the controller into Result to enable controller-dependent behaviors (e.g., tracking). |
| packages/snap-client/src/types.ts | Adds memoryOnly?: boolean to cache config typing. |
| packages/snap-client/src/Client/apis/Abstract.test.ts | Updates expected default cache config shape to include memoryOnly: false. |
| packages/snap-client/src/Client/NetworkCache/NetworkCache.ts | Implements memoryOnly gating for storage interactions and adds “skip if entry itself exceeds maxSize” logic. |
| packages/snap-client/src/Client/NetworkCache/NetworkCache.test.ts | Adds test coverage for the new memoryOnly behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
korgon
requested changes
Mar 17, 2026
korgon
left a comment
Contributor
There was a problem hiding this comment.
This looks good. However, while we are in here I think we ought to remove the redundant part of the "get" method that removes expired entries - this is already handled by "purgeExpired" at the beginning of the "get" call.
korgon
approved these changes
Mar 17, 2026
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.
…oring large objects
also added a way to disable the beacon for recommendationInstantiators