houdini icon indicating copy to clipboard operation
houdini copied to clipboard

Add ability to refresh a record

Open AlecAivazis opened this issue 2 years ago • 1 comments

Describe the feature

Right now the only way to manage invalid data is to mark it as stale. We should add a way to tell the cache to reload a particular record by notifying every current subscriber of that record to refetch.

Not sure on the exact name of the method yet but it could look something like

function applyMutation() {
    const { data } = await MyMutation.mutate()
    
    const user = cache.get("User", { id: data.updateUser.user.id })

    // options are things like "invalidate", "refresh", etc
    user.refetch()
}

Criticality

cool improvement, my projects will benefit from it

AlecAivazis avatar Feb 03 '23 18:02 AlecAivazis

For us, this would be the single largest improvement that could be made. We have so much weird code to work around this right now.

knd775 avatar Oct 12 '23 18:10 knd775