houdini
houdini copied to clipboard
Add way to mark data as stale/invalid
Discussed in https://github.com/HoudiniGraphql/houdini/discussions/286
Originally posted by frederikhors April 23, 2022 Is there an invalidate() api like https://formidable.com/open-source/urql/docs/graphcache/cache-updates/#invalidating-entities?
Maybe https://kit.svelte.dev/docs/loading#output-dependencies can be used? I.e. the generated load would put all query names into the dependencies
array and the user would be able to invalidate individual queries (but I guess it would execute the whole load function again?).
I think that this one might get a priority. What do you think?
To move forward, what do we want to support?
-
invalidate("TYPE")
-
invalidate("TYPE", "KEY")
I think we should support everything. The invalidation is CRITICAL.
Btw thanks for all your work @jycouet @AlecAivazis!
I think this is part of a larger conversation concerning how we want to organize the imperative API. Ideally we need to invalidate all instances of a type, a type with a specific id, and a field within a particular type. I think the API for doing this can get quite unwieldy unless we impose a little organization into the overall structure. I started fleshing out some of my thoughts here: #58
Let's close this one in favor of #58 which will take care of this.
I'm going to reopen this since it will come as a second effort after #748 gets merged
@AlecAivazis is this available as of today?
Tests are passing, PR will be done later today 🥳
A lot of cool things will happen in the coming days 👀