-
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
#1617 - Fetch store name from the GraphQL server at compile time #3019
#1617 - Fetch store name from the GraphQL server at compile time #3019
Conversation
|
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.
Thanks for the contribution! I had a small bit of feedback and please run prettier
:)
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.
Thanks for your contribution. Please take care of the change @sirugh requested and also handle the suggestion I have provided below. With those handled, this PR is good to go.
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.
A few more thoughts I had last second.
Co-authored-by: Stephen <sirugh@users.noreply.github.com>
Co-authored-by: Stephen <sirugh@users.noreply.github.com>
@vasilii-b I just pushed a commit with an idea that I had, not something we're positive that we want just yet. I will work with the internal team to make a decision about how we want to proceed. |
Two cents — we went back/forth on this. Some things like our manifest + static icons have to be overwritten when our Docker containers are built for our multi-site frontends. But the title ended up being simple enough to hardcode a conditional with a reasonable default (for us). I know that's not a config-only solution, but it saves an extra request at render, so we've ended up just hardcoding a lot of Magento config in frontend code that's only set once and never changed. We've started doing this as a rule now (fetching config should never delay render) for performance, but I know it only solves this at the implementation-level not the framework. Still curious to see what you come up with @sirugh |
@brendanfalkowski I pushed my approach which hopes to solve two problems:
I wanted to prevent developers from needing to make a store config query in every component, so the reasonable take was to do a single fetch somewhere. Ended up making a new Title component that just appends the fetched name. |
@@ -7,8 +7,6 @@ | |||
<meta name="theme-color" content="#ff6334"> | |||
<link rel="manifest" href="/manifest.json"> | |||
|
|||
<title><%= STORE_NAME %></title> |
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.
Is this OK? The app renders the title, not sure if we need the service worker template to do this. We wouldn't be able to ensure this is valid anyways.
@sirugh Browser title looks good but offline mode on Category and Search is broken. Steps -
|
Sort of figured it out. The category page uses a conditional to render an Edit: I was right, but the issue stemmed from not having merged in fixes for this exact but that were in develop. The merge contains the correct code :) |
Signed-off-by: sirugh <rugh@adobe.com>
Signed-off-by: sirugh <rugh@adobe.com>
…ame-from-graphql-at-build-time
QA Approved. |
Description
With the changes from this PR, the
STORE_NAME
is not hardcoded anymore from the webpack's DefinePluginpwa-studio/packages/venia-concept/webpack.config.js
Line 66 in 70cf1e0
As suggested in #1617, if
STORE_VIEW_CODE
environment variable is used, the store_name value from the corresponding available store is used. If not, use the default value returned by thegetStoreConfigData
query is used for theSTORE_NAME
.Related Issue
Closes #1617.
Acceptance
Verification Stakeholders
@revanth0212
Specification
Changes to the
venia-concept
andpwa-buildback
packages must be reviewed.Verification Steps
Setup and run the webserver.
title
tagtitle
tag value contains the store name as specified by theSTORE_VIEW_CODE
(or the default store).Screenshots / Screen Captures (if appropriate)
Checklist