Skip to content

✨ feat(skus): standalone Sku component, deprecate SkusContainer, shared debounce batch store #757

@acasazza

Description

@acasazza

Summary

Following the same pattern introduced for Price (#751), we need to:

  • Make Sku component work standalone (without SkusContainer)
  • Deprecate SkusContainer
  • Implement a module-level debounce batch store for automatic request batching

Tasks

1. Shared debounce batch store

Extract the batch store logic introduced in packages/hooks/src/pricesBatchStore.ts into a generic, reusable debounce batch store that can be consumed by any component needing it (e.g. Price, Sku, and future components).

2. packages/hooks

  • Refactor pricesBatchStore.ts to use the new shared batch store
  • Add skusBatchStore.ts using the shared batch store
  • Update useSkus.ts (or equivalent) to subscribe via useSyncExternalStore

3. packages/react-components

  • Update Sku.tsx to detect standalone mode (setSkuCodes == null), register/unregister via the store
  • Deprecate SkusContainer with migration hints (before/after examples)

4. packages/document

  • Add standalone Sku story
  • Update SkusContainer docs with deprecation notice

Deprecation

Before (deprecated):

<SkusContainer>
  <Sku />
</SkusContainer>

After (recommended):

<Sku />
<Sku />
<Sku />

All instances are automatically batched into a single API request via the shared debounce store.

References

Metadata

Metadata

Assignees

Labels

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