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 7 commits into2026-07-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
5a8ffb8 to
a384c73
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.
f914706 to
14999ed
Compare
Rename `latest` → `current` to match `shopify.cart.current` pattern, rename `StorageKeys` → `SubscribableStorage` per kumar303 suggestion, and make `current` optional per TAG decision. Ref: Shopify/ui-api-design#1416 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use non-null assertion for optional `current` property in tests - Rename single-char storage keys to satisfy id-length lint rule Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…sertions The createStorage factory always provides `current`, so narrow the return type to Required<Storage<T>> rather than forcing tests to use non-null assertions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Storage interface has `current` as optional since not all API versions support it. Tests should use optional chaining (?.) to mirror how real extension code accesses the property, rather than hiding optionality behind Required<> or non-null assertions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/snapit |
What
Add
SubscribableStoragetype and optionalcurrentproperty to the POSStorageinterface for reactive cross-target communication.Why
Extensions running across multiple targets (tile, modal, background) need to share state reactively. The
storage.currentsubscribable 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:SubscribableStorage<T>— mapped type where each key maps toReadonlySignalLike<T | undefined>, reusing the existing signal type fromshared.ts(consistent with cart, connectivity, scanner, locale APIs)current?: SubscribableStorage<BaseStorageTypes>— optional property onStorageinterface exposing each storage key as a subscribableAlso updates
ui-extensions-testermock (createStorage()) with a Proxy-basedcurrentimplementation.Companion PR
Base Branch
2026-07-rc— ships with the2026-07API version.