Skip to content

fix(networkcache): bugfix for network cache and the way it handles st…#1466

Merged
korgon merged 4 commits into
developfrom
improvements
Mar 17, 2026
Merged

fix(networkcache): bugfix for network cache and the way it handles st…#1466
korgon merged 4 commits into
developfrom
improvements

Conversation

@chrisFrazier77

Copy link
Copy Markdown
Contributor

…oring large objects

also added a way to disable the beacon for recommendationInstantiators

…oring large objects

also added a way to disable the beacon for recommendationInstantiators

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 memoryOnly support to NetworkCache to optionally bypass sessionStorage, and improve maxSize handling for oversized cache entries.
  • Introduce a shared beacon settings type and allow RecommendationInstantiator configs 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.

Comment thread packages/snap-store-mobx/src/types.ts Outdated
Comment thread packages/snap-client/src/Client/NetworkCache/NetworkCache.ts
Comment thread packages/snap-client/src/Client/NetworkCache/NetworkCache.ts

@korgon korgon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@chrisFrazier77 chrisFrazier77 requested a review from korgon March 17, 2026 21:54
@korgon korgon merged commit 3c8dc54 into develop Mar 17, 2026
1 check passed
@korgon korgon deleted the improvements branch March 17, 2026 21:55
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.

3 participants