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

fix: remove product list from search wrapper #586

Closed
wants to merge 2 commits into from

Conversation

vmourac-vtex
Copy link

@vmourac-vtex vmourac-vtex commented Sep 28, 2024

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 by vtex.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 first ProductList and vtex.product-summary is responsible for the other ProductList

This PR simply removes the ProductList from the vtex.store project, keeping the vtex.product-summary as is.

How to test it?

Workspace with error

Steps to reproduce:

  • Open the link above
  • Open DevTools
  • Go to Elements tab
  • Search (cmd+f) for the following string: {"@context":"https://schema.org","@type":"ItemList","itemListElement"

Expected Behavior:

  • You should find two occurrences of this string
  • The content of the Structured JSON that starts with the searched string must be the same (duplicates)

Workspace with fix

Steps to reproduce:

  • Open the link above
  • Open DevTools
  • Go to Elements tab
  • Search (cmd+f) for the following string: {"@context":"https://schema.org","@type":"ItemList","itemListElement"

Expected Behavior:

  • You should find only one occurrence of this string.
    • The first occurrence in the HTML, from the SearchWrapper component, has been removed

Screenshots or example usage:

Before Fix:

First Occurrence:
image

Second Occurrence:
image

After Fix:

image

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 to search.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 a search.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?

this commit has the intention to fix the dupplication of a structured data Product List that usually occurs on PLP
@vmourac-vtex vmourac-vtex requested a review from a team as a code owner September 28, 2024 01:50
@vmourac-vtex vmourac-vtex requested review from vsseixaso, RodrigoTadeuF and leo-prange-vtex and removed request for a team September 28, 2024 01:50
Copy link
Contributor

vtex-io-ci-cd bot commented Sep 28, 2024

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-io-docs-bot
Copy link

vtex-io-docs-bot bot commented Sep 28, 2024

Beep boop 🤖

I noticed you didn't make any changes at the docs/ folder

  • There's nothing new to document 🤔
  • I'll do it later 😞

In order to keep track, I'll create an issue if you decide now is not a good time

  • I just updated 🎉🎉

@vmourac-vtex vmourac-vtex requested review from iago1501 and removed request for RodrigoTadeuF and leo-prange-vtex September 28, 2024 02:09
@vmourac-vtex vmourac-vtex marked this pull request as draft September 28, 2024 02:10
@vmourac-vtex
Copy link
Author

Closing PR.
Issue fixed on search-result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant