-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add missing sw-language-id header #1657
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@shopware/api-gen
@shopware/cms-base-layer
@shopware/composables
@shopware/helpers
@shopware/nuxt-module
@shopware/api-client
commit: |
why does API ignore the current session language set by |
It's not ignoring. The second tab request overrides this session language by a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a lot of work done down here 🔥 ⛑️ 🏅
TODO:
- fix breadcrumbs for navigation because it still mixes the languages (when I refresh the page on the different language in a second tab - breadcrumbs at the first tab is in a wrong language)
TO CONSIDER:
- as
languageIdChain
is broadly used now, it still tells nothing and the name might be confusing for developers, maybe we can alias it to something more clear and fancy? - maybe we can hook-in the apiClient instance and set
sw-language-id
globally for entire app?
I'm not able to reproduce the problem with breadcrumbs. Are you sure that this is not a problem with the missing translations? Please add steps to reproduce
sure, why not
Not all endpoints consume |
you are adding it globally but behind each composable function's logic. If the context has its language set, the client could be aware of it in a global state to avoid that some requests won't be in a right language - within the whole composables package. @patzick is that improvement or shadowing the whole thing with translations and current context? or it's just not possible though 😆 |
Ok, I see, fixed and added a task for backend shopware/shopware#6630 @mkucmus, but please remember that header is not the only way to set the language. We also use context to do it. I'm afraid that we can overcomplicate it, but I'm not totally against global header :D |
CodSpeed Performance ReportMerging #1657 will not alter performanceComparing Summary
|
yup, it's already overcomplicated because we have dynamic content, reactive, bound to the Id and we synchronize the session between browser tabs - that leads to the problem we encounter. Let's do the rework of that in the future, starting from the backend to ensure that the global sw-language-id header can be applied for every endpoint. |
This should be collected and driven by the API working group. 💯 |
Description
This pull request includes several changes to add the missing
sw-language-id
header property for API calls across multiple components and modules. The most important changes are grouped by theme as follows:API Header Updates:
sw-language-id
header property for API calls inuseCart
,useCategorySearch
,useCheckout
,useCustomerOrders
,useInternationalization
, anduseLandingSearch
composables. [1] [2] [3] [4] [5] [6]Import and Context Updates:
useSessionContext
in various files to accesslanguageIdChain
. [1] [2] [3] [4] [5] [6]Test Updates:
sw-language-id
header property for API call expectations inuseCart
,useCategorySearch
,useInternationalization
, anduseListing
components. [1] [2] [3] [4]Component-Specific Changes:
sw-language-id
header property inSwContactForm.vue
andApp.vue
components. [1] [2]closes #1651
Type of change
ToDo's
Screenshots (if applicable)
Additional context