How to architect: local resolver re-populates from ssrExchange #3760
Unanswered
frantisek-heca
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We are running Next Pages Router app, having
getServerSideProps.The first time user visits a product page, the
ssrExchangepopulates correctly the client's cache withProductQuery.The consequtive visits of the same product, the
getServerSidePropsis designed by us to send a freshProductQueryin thessrExchange.But it's not needed/used, the cached version is already present...
Which was ok until we we wanted to have fresh data from the
ProductQueryon each visit.I tried to use local resolver and return
undefined(for the ProductQuery).Thinking that the
ssrExchangewill provide the already presentProductQuery.But somehow it's not working.
When I debug naively the source code...
It seems after returning
undefinedfrom a resolver, it does trigger thessrExchangedata correctly.But then it tries to
updateCacheWithResultand inside it does_query(queryResult) the sameProductQueryand the resolver is triggered again and returnsundefinedand it loops in this pattern.Any ideas, advice, please?
I cannot play with (work with) ssrExchange cache from resolvers, right?
Beta Was this translation helpful? Give feedback.
All reactions