Closed ewen-lbh closed 2 weeks ago
I ran into the same issue a while back at work. I solved it after some troubleshooting by adding a @with
on the _insert
fragment spread.
Maybe we could add a step in the codegen pipeline that throws an error when list inserts require arguments, so that it's clear what's going on?
I'm going to close this sicne there is a work around.
Describe the bug
Hi, just stumbled upon this today.
Take the following list fragment declaration:
and the following mutation:
The runtime tries to fetch the
paidBy
field without giving it a value when calling .mutate on that mutation store.I guess the codegen should not generate _insert fragments that define fields that depend on variables.
Or maybe define those variables on the fragment and require giving them values with
@with
. i guess the library user cannot use@arguments
on@list
? if they can, maybe this should also be enforced by the codegenThe "repro link" is a gist of the full graphql request as sent by the runtime when calling .mutate. The gist also has a link to the schema (I tried copy-pasting it in the gist and my browser freezed lmao)
Reproduction
https://gist.github.com/ewen-lbh/bc2d092cbf48b5f720f5c02026095e4a
Workaround
In the meantime, I'm kind of "manually" marking the cached data as stale and re-fetching: