-
Notifications
You must be signed in to change notification settings - Fork 685
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
Fetch store name from the GraphQL server at compile time. #1617
Comments
Check the Risks & Caveats section of #1739 for issues we may run into when fetching GraphQL data at build time. That said, "store name" should theoretically not change all that often 😄 |
We already have a relatively new plugin which gets the media URL from GraphQL at build time. Who wants to extend it? You'll need:
|
removing help wanted and needs additional core investigation |
@magento export issue to JIRA project PWA as Story |
✅ Jira issue (https://jira.corp.magento.com/browse/PWA-1463) is successfully created for this issue. |
I have checked both the queries and both seem to be returning the Here are the results of both the queries: getStoreConfigData.graphql {
id: 1,
code: "default",
locale: "en_US",
secure_base_media_url: "https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/",
store_name: "Default Store View",
} getAvailableStoresConfigData.graphql [
{
code: "default",
id: 1,
secure_base_media_url: "https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/",
store_code: "default",
store_name: "Default Store View",
default_display_currency_code: "USD",
},
{
code: "fr",
id: 2,
secure_base_media_url: "https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/",
store_code: "fr",
store_name: "French Store View",
default_display_currency_code: "EUR",
},
] Is this expected? |
Yes. You expect Venia because we hard-coded it. What you're actually seeing now is the real sample data. |
* #1617 - Fetch store name from the GraphQL server at compile time * format the code with prettier * remove unnecessary declarations * Simplify the process of finding the available store Co-authored-by: Stephen <[email protected]> * Simplify the assignment of current store name Co-authored-by: Stephen <[email protected]> * Fix destructure syntax * prettier * availableStore -> availableStores * Use runtime store name fetch in a new TitleWithStore component. Signed-off-by: sirugh <[email protected]> * StoreTitle * Fix tests * Fix error view rendering when data was still returned Signed-off-by: sirugh <[email protected]> * fix test snap Signed-off-by: sirugh <[email protected]> Co-authored-by: Stephen <[email protected]> Co-authored-by: Stephen <[email protected]> Co-authored-by: Revanth Kumar Annavarapu <[email protected]> Co-authored-by: Devagouda <[email protected]>
Is your feature request related to a problem? Please describe.
This is related to #1595. As part of that PR, we have created a global variable called
STORE_NAME
that can be added to the bundle at compile time using the Webpack Define plugin. Instead of hardcoding it in Define plugin, can we request that from the GraphQL server and then insert that into theglobal
object just like the Define plugin?Describe the solution you'd like
store_name
, as per theStoreConfig
schema.store_name
.STORE*VIEW_CODE
environment variable is used, use the store*name value from the correspondingavailableStore
. If not, use the default value returned by the getStoreConfigData query.Describe alternatives you've considered
We can expect the partner developers to simply change the hardcoded string in webpack's Define plugin.
Please let us know what packages this feature is in regards to:
venia-concept
venia-ui
pwa-buildpack
peregrine
pwa-devdocs
upward-js
upward-spec
Test Plan:
The text was updated successfully, but these errors were encountered: