fix: remove product list from search wrapper #586
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem is this solving?
This commit has the intention to fix the duplication an array of structured data Product List, that usually occurs on PLP pages.
The
ProductList
is a component exported byvtex.structured-data
. It aims provide necessary information to google to render Rich Results in Google.We found out that there are two ocurences of ProductList in the same PLP.
The SearchWrapper element from
vtex-apps/store
is responsible for the firstProductList
andvtex.product-summary
is responsible for the otherProductList
This PR simply removes the
ProductList
from thevtex.store
project, keeping thevtex.product-summary
as is.How to test it?
Workspace with error
Steps to reproduce:
{"@context":"https://schema.org","@type":"ItemList","itemListElement"
Expected Behavior:
Workspace with fix
Steps to reproduce:
{"@context":"https://schema.org","@type":"ItemList","itemListElement"
Expected Behavior:
SearchWrapper
component, has been removedScreenshots or example usage:
Before Fix:
First Occurrence:
Second Occurrence:
After Fix:
Describe alternatives you've considered, if any.
We tried approaching the problem by adding a conditional in vtex.product-summary that uses
useRuntime().page
to check if the user is in a search page (evaluates tosearch.page#<context>
).It was considered a safer approach that would cover possible scenarios where a search page can exist without a PLP.
Unfortunately, It did not work because when
useRuntime().page
is evaluated, it returnsstore.home
(in sportline). Also, when checking for__RUNTIME__.page
in the browser console, the page correctly evaluates to asearch.page#<context>
. I did not understand why this happened, so I am submitting this PR instead.Related to / Depends on
N/A
How does this PR make you feel?