Skip to main content
A locally persisted wishlist — no API calls, tied to the device, not to the customer account. Items can be saved per product or per variant, with the selected options, title and image, so a wishlist screen renders without re-fetching the catalog.

Usage

Save a whole product (legacy-compatible)

Save a specific variant

A variant-saved item is a distinct entry from the product-wide one, and two variants of the same product can both be saved.

Wishlist screen

Hook API

isInWishlist and items read the same react-query cache, so every mounted screen (product hearts, drawer badge, wishlist list) stays in sync: each mutation invalidates sdkKeys.wishlist() and the list refetches from the service’s in-memory state.

Service API

getItems() returns copies (including selectedOptions), so callers cannot mutate the service’s internal state.

Storage and migration

On the first boot after upgrading, the service reads the legacy list, normalizes it (id = productId, createdAt/updatedAt/addedAt from the stored addedAt), writes wishlist_v2, and removes the legacy key. The migration is one-time and idempotent: later boots read wishlist_v2 directly. Duplicate entries are de-duplicated by id (first occurrence wins), unusable entries are dropped, and a corrupt stored value is treated as an empty wishlist — a bad value never blocks app start.

How It Works

  • Initialized from AsyncStorage when StackfrontProvider mounts, before ready flips.
  • All mutations update in-memory state and persist to wishlist_v2.
  • isInWishlist is synchronous — no async check needed.
  • The wishlist is per device. Server sync (Firebase/Supabase adapters) is out of scope.