Skip to content

Implement SDK state persistence across page reloads via sessionStorage #399

Description

@Kingsman-99

Overview

The SDK loses all cached state on page reload, causing redundant RPC calls on navigation. Add opt-in sessionStorage persistence so cached data survives page refreshes within the same browser tab.

Acceptance Criteria

  • StellarSplitSDK({ cache: { persist: 'session' } }) option enables sessionStorage persistence
  • On init, SDK hydrates its in-memory cache from sessionStorage entries that are not yet expired
  • On cache write, entry is also written to sessionStorage with expiry timestamp
  • On cache evict/invalidate, entry is removed from sessionStorage
  • Storage key prefix: split-sdk-cache: to avoid collisions
  • Graceful degradation: if sessionStorage is unavailable (private browsing quota), falls back to memory-only silently
  • sdk.clearPersistedCache() wipes all split-sdk-cache: keys from sessionStorage
  • Does not persist in Node.js environments (sessionStorage unavailable — silently skipped)

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions