-
Notifications
You must be signed in to change notification settings - Fork 5
chore: Improve overall performance #418
Conversation
Preview is readyThis pull request generated a Preview👀 Preview: https://preview-418--base.preview.vtex.app |
✅ Deploy Preview for basestore ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Gatsby Cloud Build Reportbasestore 🎉 Your build was successful! See the Deploy preview here. Build Details🕐 Build time: 15m PerformanceLighthouse report
|
Hey, you changed nothing. The purpose is to add just the mark hoc? @tlgimenes |
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.
Following @igorbrasileiro's question, I assume this PR is missing the part where the faststore package is updated to reflect the improvements.
Yes, this part was missing, I had only done it locally for extracting the images. Now we have the full version |
Results after run 20 psi tests via api
Page result - https://sfj-3321c99--base.preview.vtex.app/
|
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.
Nice!! 🚀
What's the purpose of this pull request?
#295 added login functionality. This, however, introduced an unnecessary re-render of the whole app. This PR removes the need for this re-render, thus reducing TBT and increasing overall performance
How does it work?
#295 made the return type of the
person
query to beStorePerson!
. This means that the query result of person returns the following value for the anonymous user:This, in turn, is different from the default user session, passed in the context provider as
null
. This mismatch in values, caused the session to be reset for the anonymous user, causing an unnecessary re-render.To fix this issue, I made the api return
null
for theperson
query when executed by an anonymous user. This matches the default value from the session, this not triggering a re-render. All changes are performed on this PR at faststoreAn evidence can be seen below were the first image shows the
ProductGallery
component being rendered twice (due to session being reset) and the second image shows the absence of this re-render after the proposed fix.How to test it?
Make sure everything works as before and
ProductGallery
renders once.Checklist