feat(pos): add storage.latest subscribable types to Storage interface#4235
feat(pos): add storage.latest subscribable types to Storage interface#4235vctrchu wants to merge 5 commits into2026-04-rcfrom
Conversation
🚨🚨🚨 Docs migration in progress 🚨🚨🚨We are actively migrating UI extension reference docs to MDX in the
During this migration, please be aware of the following:
Doc comments in Examples that previously lived in this repo are being moved to the What should I do?
Thanks for your patience while we complete the migration! 🙏 |
5a42408 to
36bfa6a
Compare
Add Subscribable, StorageKeys types and optional keys property to the POS Storage interface. Each key is exposed as Subscribable<T | undefined> for reactive cross-target communication within the same extension. Available on API version 2026-04 and later. Part of: shop/issues-retail#26020 TAG PR: Shopify/ui-api-design#1416 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…le type Replace custom Subscribable interface with the existing ReadonlySignalLike from shared.ts — identical shape, already used by cart, connectivity, scanner, and locale APIs. Fix @example to use api.storage instead of shopify.storage.
Aligns with ui-api-design#1416 rename. Updates JSDoc with cross-target reactivity example and .value/.subscribe() documentation. Updates tester mock with Proxy-based latest implementation.
5a8ffb8 to
a384c73
Compare
Covers set/get/delete/clear/entries, storage.latest subscribable access, createCartLineItem defaults and overrides, and createResult mock.
Covers set/get/delete/clear/entries and storage.latest subscribable access (value reads, reflects updates via set, undefined for missing keys, unsubscribe function).
| const latestProxy = new Proxy({} as StorageKeys<T>, { | ||
| get(_target, prop) { | ||
| return createSubscribable(prop as string); | ||
| }, | ||
| }); |
What
Add
StorageKeystype andlatestproperty to the POSStorageinterface for reactive cross-target communication.Why
Extensions running across multiple targets (tile, modal, background) need to share state reactively. The
storage.latestsubscribable enables one target to subscribe to a key and react when another target updates it viaset()ordelete().TAG PR: ui-api-design#1416
Issue: shop/issues-retail#26020
How
Changes to
packages/ui-extensions/src/surfaces/point-of-sale/types/storage.ts:StorageKeys<T>— mapped type where each key maps toReadonlySignalLike<T | undefined>, reusing the existing signal type fromshared.ts(consistent with cart, connectivity, scanner, locale APIs)latest: StorageKeys<BaseStorageTypes>— required property onStorageinterface exposing each storage key as a subscribableAlso updates
ui-extensions-testermock (createStorage()) with a Proxy-basedlatestimplementation.Companion PR
Base Branch
2026-04-rc— ships with the2026-04API version.