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

Multiple re-renders due to decorators that fetch data using Apollo #142

Closed
mikemurray opened this issue Jun 12, 2018 · 3 comments
Closed
Assignees
Labels
bug For issues that describe a defect or regression in the released software
Milestone

Comments

@mikemurray
Copy link
Member

mikemurray commented Jun 12, 2018

Issue

The decorators, withTag withCatalogItems specifically on the tag page, cause the component to rerender twice. This isn't a huge issue in itself; however, add tracking and now we get multiple duplicate events triggered in Segment with different data.

First, the data comes in with all of the products for the page without filtering, then the second event has the list with the filtering by tag.

Question

Should we start considering ways to combine queries for data for into a single query? This would be more in the spirit of GraphQL by making one request for everything we need for a page. Though, it would mean more bespoke queries that may only have a single

Reproduction

  1. Create a segment account and get the API key. Add the key to the .env (see .env.example)
  2. Start the app navigate to a tag grid
  3. In the segment dashboard under sources > javascript > debugger see the events being tracked
  4. If you refresh the tag page, you should see multiple Product List Viewed events being fired, once with all products, once with only the products for that tag page (if you have your data set up in a way that has many products in many tags)
@mikemurray mikemurray added the discussion For issues in which discussion is expected but no further action is needed label Jun 12, 2018
@spencern spencern added this to the Grays milestone Jun 14, 2018
@aldeed
Copy link
Contributor

aldeed commented Jun 25, 2018

Assigned to @kieckhafer to see whether this is still reproducible

@kieckhafer
Copy link
Member

Can confirm this is happening.

@spencern spencern added bug For issues that describe a defect or regression in the released software and removed discussion For issues in which discussion is expected but no further action is needed labels Jun 25, 2018
@spencern spencern modified the milestones: Grays, Humbolt Jun 25, 2018
@willopez
Copy link
Member

willopez commented Jul 9, 2018

Seems to be a known issue, and a fix has been posted here: vercel/next.js#4734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For issues that describe a defect or regression in the released software
Projects
None yet
Development

No branches or pull requests

6 participants