hydrogen
hydrogen copied to clipboard
Localization queries on Storefront API not respecting context filters
What is the location of your example repository?
No response
Which package or tool is having this issue?
Storefront API
What version of that package or tool are you using?
2023-07
What version of Remix are you using?
No response
Steps to Reproduce
We're in the process of building a locale selector that will display available countries and languages as returned by the Storefront API.
Because of the @inContext filter I would expect the following query to return available available country names in english. Instead, it returns country names in the store's default language (in this case, Japanese)
query @inContext(language: EN) {
localization {
availableCountries {
name
}
}
}
Important note: english does not exist as a configured language within this instance (brand is split across several regional instances)
Expected Behavior
{
"data": {
"localization": {
"availableCountries": [
{
"name": "China"
},
{
"name": "Hong Kong"
},
{
"name": "Japan"
},
{
"name": "South Korea"
},
{
"name": "Taiwan"
}
]
}
},
"extensions": {
"context": {
"country": "JP",
"language": "JA"
}
}
}
Actual Behavior
{
"data": {
"localization": {
"availableCountries": [
{
"name": "中国"
},
{
"name": "中華人民共和国香港特別行政区"
},
{
"name": "日本"
},
{
"name": "韓国"
},
{
"name": "台湾"
}
]
}
},
"extensions": {
"context": {
"country": "JP",
"language": "JA"
}
}
}