refine
refine copied to clipboard
[BUG] useMutation Result type has wrong return names
Describe the bug If I send a mutation with useStepsForm, the return key is given automatically. For example, if I have a page like 'alarm',
return { alarm: { id: result.insertedId.toString() } };
It should return as . However, the values returned on the client side are captured directly as data.id
If I use a type converter like https://www.the-guild.dev/graphql/codegen/plugins/typescript/typescript-react-query codegen, on the client side, the type checker asks me to use data.alarm.id.
Because my Graphql schema is designed in the desired structure in useStepsForm. Codegen converter also converts accordingly.
Expected behavior If there is an automatically created parent object name, it should also be written on the client side.
Hey @emehmet , Thank you for contacting us! I'm not sure this is a bug. If possible, can you create a new one with the FEAT issue template?
Hey @omeraplak,
In this case, I created two types for the expected object structure in return and overcame it by using the subtype in the client. Yes, it may not be a bug.
export type AlarmResultData = {
id: Scalars['String'];
};
export type AlarmResult = {
alarm?: Maybe<AlarmResultData>;
};
and i use it like this
useStepsForm<AlarmResultData>()
Hey @emehmet , We would love to support this use case, but we cannot consider it a bug. Could you please create an issue by selecting the "Feature" type? Thank you very much for your understanding and patience 🎯