-
Notifications
You must be signed in to change notification settings - Fork 5
fix(codegen): use correct deleted{Entity}NodeId field in delete mutation #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
wait, what is |
|
I think this is an incorrect fix, I'm not sure we should be referencing anything
we purposefully skip the Node ids are a graphql thing we don't use and they're literally useless. Maybe something broke, or we're not using graphile-settings somewhere in codegen? |
|
literally everything that |
|
From research: The deletedDatabaseNodeId field is not a bug - it's expected behavior even with NodePlugin disabled. What's happening: In <ref_snippet file="/home/ubuntu/repos/constructive/graphile/graphile-settings/src/index.ts" lines="90-90" />, the NodePlugin is correctly being skipped: However, the deletedDatabaseNodeId field comes from a different mechanism. PostGraphile's mutation plugins (specifically PgMutationUpdateDeletePlugin) add deletedNodeId fields to delete mutation payloads for Relay-style cache invalidation - this is separate from the NodePlugin. The field name itself is generated by the deletedNodeId inflector in <ref_snippet file="/home/ubuntu/repos/constructive/graphile/graphile-simple-inflector/src/index.ts" lines="211-215" />: What is NodeId? NodeId is PostGraphile's implementation of Relay's Global Object Identification spec - a globally unique, opaque ID that encodes the table name and primary key. It's used for:
Skipping NodePlugin removes:
But it does NOT remove:
If you want to remove deletedDatabaseNodeId, you'd need a custom plugin to omit that field from mutation payloads, or use smart tags to omit it. |
|
removed the |
|
1 test failing, fixing |
8dc37f9 to
c595778
Compare
Remove the deletedNodeId field from generated delete mutations as it's no longer used due to internal backend concerns. The field still exists in the GraphQL schema but is no longer selected in generated code. Changes: - Remove deletedNodeIdFieldName from mutation selection in gql-ast.ts - Remove deletedNodeIdProp from result interface in mutations.ts - Remove getDeletedNodeIdFieldName and getDeletePayloadTypeName helpers - Remove typeRegistry parameter from mutation generation - Update test snapshots
c595778 to
63929a2
Compare

Problem
The React Query hooks generator was producing delete mutations with a hardcoded deletedId field, but our backend convention switched to use type-specific field names. I think this is very recent?
deleted{EntityName}NodeIdBefore (broken)
deleteUser(input: $input) { deletedId }After (correct)
deleteUser(input: $input) { deletedUserNodeId }Solution