Skip to content
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

currentStoreView() is empty in metaInfo() on SSR product page #3674

Closed
2 of 5 tasks
cewald opened this issue Oct 1, 2019 · 2 comments
Closed
2 of 5 tasks

currentStoreView() is empty in metaInfo() on SSR product page #3674

cewald opened this issue Oct 1, 2019 · 2 comments
Assignees
Labels
bug Bug reports P2: Important Priority mark - still high ;)
Milestone

Comments

@cewald
Copy link
Contributor

cewald commented Oct 1, 2019

Current behavior

The storeView state is empty when you call it inside metaInfo() on a server-side request of a single-file-component – like in the product-details-page.

I didn't found a way yet to get the current store view using the state management in metaInfo(). I want to show the current currency-sign and default-language-code inside an meta-tag.

I read about common vue-meta caveats but couldn't get any reactivity for any store-view variable.

Expected behavior

It should be possible to get, for example, the currency code of the current store for meta-tags using the current storeView state.

Steps to reproduce the issue

  • Log the currentStoreView() in metaInfo() of src/themes/default/pages/Product.vue.
  • Visit a product and reload the page (server-side-request)
  • See an empty object in your server-logs

Repository

develop 99a493d

Can you handle fixing this bug by yourself?

  • YES
  • NO

Which Release Cycle state this refers to? Info for developer.

Pick one option.

  • This is a bug report for test version on https://test.storefrontcloud.io - In this case Developer should create branch from develop branch and create Pull Request 2. Feature / Improvement back to develop.
  • This is a bug report for current Release Candidate version on https://next.storefrontcloud.io - In this case Developer should create branch from release branch and create Pull Request 3. Stabilisation fix back to release.
  • This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create branch from hotfix or master branch and create Pull Request 4. Hotfix back to hotfix.

Environment details

  • Browser: Chrome
  • OS: OSX
  • Node: 10 LTS
  • Code Version: develop
@cewald cewald added the bug Bug reports label Oct 1, 2019
@pkarw pkarw added the P2: Important Priority mark - still high ;) label Oct 1, 2019
@patzick patzick added this to the 1.11.0-rc.1 milestone Oct 3, 2019
@patzick patzick closed this as completed Oct 3, 2019
@cewald
Copy link
Contributor Author

cewald commented Oct 3, 2019

@andrzejewsky Thanks for this fix! I only have one question: Why not hydrate the whole storeView object and just { storeCode: currentState.storeView.storeCode }?

@andrzejewsky
Copy link
Contributor

@cewald It's because storeView could be really big object, that's why we filter that field from the initial state. The best solution would be keeping entire storeView in the SSR and cut it jus before sending to the client side, but it was hard to implement, so I simply whitelisted just storeCode, which was required to render metaInfo correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports P2: Important Priority mark - still high ;)
Projects
None yet
Development

No branches or pull requests

4 participants