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
-
We are running Next Pages Router app, having
getServerSideProps
.The first time user visits a product page, the
ssrExchange
populates correctly the client's cache withProductQuery
.The consequtive visits of the same product, the
getServerSideProps
is designed by us to send a freshProductQuery
in 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
ProductQuery
on each visit.I tried to use local resolver and return
undefined
(for the ProductQuery).Thinking that the
ssrExchange
will provide the already presentProductQuery
.But somehow it's not working.
When I debug naively the source code...
It seems after returning
undefined
from a resolver, it does trigger thessrExchange
data correctly.But then it tries to
updateCacheWithResult
and inside it does_query
(queryResult) the sameProductQuery
and the resolver is triggered again and returnsundefined
and 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