houdini icon indicating copy to clipboard operation
houdini copied to clipboard

Add way to mark data as stale/invalid

Open AlecAivazis opened this issue 2 years ago • 4 comments

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?

AlecAivazis avatar Apr 25 '22 06:04 AlecAivazis

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?).

fehnomenal avatar Apr 25 '22 17:04 fehnomenal

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")

jycouet avatar Jul 04 '22 22:07 jycouet

I think we should support everything. The invalidation is CRITICAL.

Btw thanks for all your work @jycouet @AlecAivazis!

frederikhors avatar Jul 04 '22 23:07 frederikhors

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

AlecAivazis avatar Jul 04 '22 23:07 AlecAivazis

Let's close this one in favor of #58 which will take care of this.

jycouet avatar Nov 10 '22 08:11 jycouet

I'm going to reopen this since it will come as a second effort after #748 gets merged

AlecAivazis avatar Dec 09 '22 07:12 AlecAivazis

@AlecAivazis is this available as of today?

frederikhors avatar Jan 20 '23 11:01 frederikhors

Tests are passing, PR will be done later today 🥳

A lot of cool things will happen in the coming days 👀

jycouet avatar Jan 20 '23 11:01 jycouet