Skip to content

✨ feat(skus): standalone Sku and SkuList components, deprecate containers#758

Merged
acasazza merged 1 commit intov5.0.0from
feat/standalone-sku-list
Apr 27, 2026
Merged

✨ feat(skus): standalone Sku and SkuList components, deprecate containers#758
acasazza merged 1 commit intov5.0.0from
feat/standalone-sku-list

Conversation

@acasazza
Copy link
Copy Markdown
Member

Summary

Implements standalone <Sku> and <SkuList> components that auto-fetch data without requiring container parents. Containers are deprecated but remain fully backwards-compatible.

Changes

@commercelayer/core

  • ✨ Add createBatchStore — generic debounced batch store factory

@commercelayer/hooks

  • ✨ Add skusBatchStore (uses createBatchStore)
  • ✨ Add useSkuList singular hook (SWR-based, fetches single list by ID)
  • ♻️ Refactor pricesBatchStore to use createBatchStore
  • ♻️ Update useSkus with useSyncExternalStore batching

@commercelayer/react-components

  • ✨ Add standalone <Sku> — batches sibling SKU codes into one API request via debounce store
  • ♻️ Update <SkuList> — standalone mode auto-fetches list by ID, accepts params/loader props
  • ⚠️ Deprecate <SkusContainer>
  • ⚠️ Deprecate <SkuListsContainer>

Docs

  • 📝 Add standalone usage examples in stories and MDX

Other

  • 🤖 Add Copilot cloud agent biome-check postToolUse hook

Usage

// Standalone Sku (preferred)
<CommerceLayer accessToken="...">
  <Sku skuCode="TSHIRTWS000000FFFFFFLXXX">
    <SkuField attribute="name" tagElement="h2" />
  </Sku>
</CommerceLayer>

// Standalone SkuList (preferred)
<CommerceLayer accessToken="...">
  <SkuList id="yZjQIDxrly" params={{ fields: { skus: ["code", "name"] } }}>
    <Skus>
      <SkuField attribute="name" tagElement="h2" />
    </Skus>
  </SkuList>
</CommerceLayer>

Closes #757

…ners

- Add standalone <Sku> component with shared debounce batch store via createBatchStore
- Add standalone <SkuList> component with SWR-based single-list fetching
- Deprecate <SkusContainer> and <SkuListsContainer> (backwards compatible)
- Add shared createBatchStore factory in @commercelayer/core
- Add skusBatchStore in @commercelayer/hooks mirroring pricesBatchStore
- Refactor pricesBatchStore to use createBatchStore
- Add useSkuList (singular) hook for standalone SkuList
- Add Copilot cloud agent biome-check.mjs postToolUse hook
- Update docs/stories with standalone usage examples

Closes #757
@acasazza acasazza added enhancement New feature or request components Components package labels Apr 27, 2026
@acasazza acasazza self-assigned this Apr 27, 2026
@acasazza acasazza merged commit 633a166 into v5.0.0 Apr 27, 2026
2 checks passed
@acasazza acasazza deleted the feat/standalone-sku-list branch April 27, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

components Components package enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant