-
Notifications
You must be signed in to change notification settings - Fork 61
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
Stale product data on PDP #2399
Comments
Hey @batzlerg, first of all thank you for this one, improvements proposals are always welcome and help us to evolve even more the product 🤝 Regarding the bug I have a question: do you think that having slightly different queries being fetched (one on server and the other on client-side) are a problem, or is the refetch itself bad? Even though the on-demand revalidation (ISR) is still in our sights, we don't support it on our infrastructure yet, but it would be the best possible solution indeed. |
I think different queries makes sense conceptually, because some data will become stale more rapidly than other data. what caught our team off guard is the intersection of two issues:
so until some form of revalidation is supported, I think it would help to call out in the docs that extensions to ServerProductQuery will only ever be fetched once (/ according to the described behavior above). perhaps having a shared static cache would also help in the interim, but I could see that adding more infra complexity than just supporting revalidation. |
I'm opening this as a question because it feels like a feature request, documentation request, and bug report all rolled into one.
Describe the issue
PDP product data (ServerProductQuery) is pulled during initial build in
getStaticProps
, and never revalidated. There is a manual client data refetch, but it uses ClientProductQuery, which is not 1:1.This has led to at least two concrete issues in our team's experience:
productStock
is only in the ServerProductQuery, it isn't updated by the client data refetch.pdp_price_conflict.mp4
Possible Solution
I think the ideal solve would be to support a
revalidate
value to pass intogetStaticProps
insidep.tsx
. This would be a low-lift way of allowing users to configure an expected "cache time" for product updates, without forcing teams to rebuild their application periodically to pick up catalog changes.A more elegant solution is to allow users to revalidate on demand (for example, we could hook up to receive VTEX catalog changes via broadcaster), but exposing that functionality involves additional work.
Also, clarification to the existing documentation would be helpful - while the ServerProductQuery and ClientProductQuery docs call out the fallback /
getStaticProps
pattern, it would be great to highlight the implications of using two different, overlapping queries to fetch the product data, for how developers should build API extensions / think about the PDP render cycle.The text was updated successfully, but these errors were encountered: