feat(composables): add opt-in cacheableReads for cacheable GET Store API requests#2473
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in cacheableReads flag to route selected Store API read operations through cacheable GET endpoints (using compressed _criteria) instead of POST, wiring the flag through Nuxt runtime config and Shopware context so composables/templates can switch behavior without changing public composable APIs.
Changes:
- Add
cacheableReadsto the Nuxt module options + plugin context creation, and expose it viauseShopwareContext(). - Update multiple composables (and a couple templates) to use
*Get getStore API operations and_criteria: encodeForQuery(criteria)whencacheableReadsis enabled. - Extend/adjust unit tests to cover both POST (default) and GET (opt-in) paths, and add a changeset entry.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/vue-starter-template/app/components/form/SalutationSelect.vue | Switch salutation load to GET variant when cacheableReads is enabled. |
| templates/vue-demo-store/app/pages/wishlist.vue | Use _criteria + GET product read when cacheableReads is enabled. |
| packages/nuxt-module/src/index.ts | Document and expose cacheableReads on ShopwareNuxtOptions. |
| packages/nuxt-module/plugin.ts | Pass cacheableReads from runtime config into createShopwareContext. |
| packages/composables/src/useUser/useUser.ts | Use GET + _criteria for country/salutation lookups when enabled. |
| packages/composables/src/useUser/useUser.test.ts | Add/adjust tests for POST default vs GET opt-in behavior. |
| packages/composables/src/useShopwareContext/useShopwareContext.ts | Add cacheableReads to the context type and return value. |
| packages/composables/src/useSalutations/useSalutations.ts | Use salutation GET read when enabled. |
| packages/composables/src/useProductSearch/useProductSearch.ts | Use product detail GET + _criteria when enabled. |
| packages/composables/src/useProductSearch/useProductSearch.test.ts | Add GET-path test coverage for cacheableReads. |
| packages/composables/src/useProductConfigurator/useProductConfigurator.ts | Use product GET + _criteria when enabled for variant lookup. |
| packages/composables/src/useNavigationSearch/useNavigationSearch.ts | Use SEO URL GET + _criteria when enabled. |
| packages/composables/src/useNavigationSearch/useNavigationSearch.test.ts | Add GET-path test coverage for cacheableReads. |
| packages/composables/src/useNavigation/useNavigation.ts | Use navigation GET + _criteria (and depth/buildTree as query params) when enabled. |
| packages/composables/src/useNavigation/useNavigation.test.ts | Add GET-path test coverage for cacheableReads. |
| packages/composables/src/useInternationalization/useInternationalization.ts | Use languages GET read when enabled. |
| packages/composables/src/useCountries/useCountries.ts | Use countries GET + _criteria when enabled. |
| packages/composables/src/useCategorySearch/useCategorySearch.ts | Use category list GET + _criteria when enabled for advancedSearch. |
| packages/composables/src/useCategorySearch/useCategorySearch.test.ts | Add GET-path test coverage for cacheableReads. |
| packages/composables/src/createShopwareContext.ts | Add cacheableReads option and store it on the Shopware context. |
| .changeset/post-to-get-cacheable-reads.md | Publish-facing changeset describing the new opt-in behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Patryk Tomczyk (patzick)
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Opt-in
cacheableReadsflag that routes anonymous Store API reads through their cacheable GET variants (criteria via_criteria) instead of POST.Off by default - fully backwards compatible.
related issue to enable
readProductListingGetoperation: shopware/shopware#17204Why
POST reads can't be HTTP/CDN-cached and trigger a CORS preflight. The GET variants return the same data, are cacheable, and skip the preflight.
Enable