graphql-relay-js
graphql-relay-js copied to clipboard
fix: fix output type for mutate and get payload
@benjie would it be possible for you to take a look?
this is breaking for everybody
I would go with a patch or minor
Won’t break for existing use cases
I'm unfamiliar with this code, however I note from the description:
- mutateAndGetPayload will receive an Object with a key for each
- input field, and it should return an Object with a key for each
- output field. It may return synchronously, or return a Promise.
Currently the type doesn't allow for a promise, so if this is permitted as the comment implies then the types should allow for it.
I'm unsure what the knock-on consequences of this change will be, and if it needs a semver major release.
In case, I would say that doesn't have any side implication of this type definition. It just allows us to handle the mutateAndGetPayload in two ways:
1:
mutateAndGetPayload: () => {
// ...
}
2:
mutateAndGetPayload: async () => {
// ...
}
Which is already allowed before, but by the PR we're inserted the generic types, have been strictly removed.
Ah https://github.com/graphql/graphql-relay-js/pull/389 broke it! Thanks for the info on that @noghartt I can see this is clearly a fix now :+1:
I've published this as [email protected]; please can someone confirm that it works correctly and if so I will update the tag from @next to @latest. Thanks!