Open JoviDeCroock opened 4 years ago
I think the order importance of exchanges is a bit of a pain but I'm not sure nesting them inside the cache is the way to go.
Are there any specific decorators that can't be resolved before/after the cache?
Are there any specific decorators that can't be resolved before/after the cache?
No but I'm trying to find a middle ground on this. Much like for instance redux has middlewares it could be used to make our cache smarter (and we need to solve the issue anyway so I thought let's look for a very extendable solution)
I think it's sufficient to fix https://github.com/FormidableLabs/urql-exchange-graphcache/issues/146 in isolation :)
@kitten do you agree with @andyrichardson to catch a directive like extra
in a separate exchange?
Idea
Related to https://github.com/FormidableLabs/urql-exchange-graphcache/issues/146 I'd like to extend our
traverser
to have a certain set of directives like the one proposed in the issue@extra
. When passed to thecacheExchange
it would automatically stop at these directives, strip them out and execute a callback allowing you to return an altered operation, ....This would for example allow you to add more variables, allow the
populateExchange
to become a HOC passed into this object.Rough example
This is very rough and I'll most likely alter this when hacking on it but I would like to send this in to get some more idea's