Skip to content
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

Nested entity from a custom mutation result fails at runtime #1458

Open
eddiesholl opened this issue Dec 18, 2024 · 0 comments
Open

Nested entity from a custom mutation result fails at runtime #1458

eddiesholl opened this issue Dec 18, 2024 · 0 comments

Comments

@eddiesholl
Copy link
Contributor

eddiesholl commented Dec 18, 2024

Describe the bug
The resolver for a nested entity (batchCode in this case) is failing at runtime when I have selected a list of entities with a child entity. The selection is coming off the result of a custom mutation.

Cannot read properties of undefined (reading 'batchCode')\n    at id .../src/packages/backend/.graphweaver/backend/index.js:768:51)\n    at _listRelationshipField (.../src/node_modules/.pnpm/@exogee+graphweaver@2.9.7_encoding@0.1.13/node_modules/@exogee/graphweaver/lib/resolvers.js:380:15)

I believe the problem is at this line of code. The source must be a graphql entity that does not have the 'dataEntity' populated

idValue = id(dataEntityForGraphQLEntity<G, D>(source as any));

To Reproduce
Steps to reproduce the behavior:

  1. Define an entity that has a nested entity
  2. Create a custom mutation that returns a list of the parent entities
  3. The mutation should return microform entity instances
  4. Select the 2 levels of entities

Expected behavior
This should not fail at runtime

Actual behavior
It throws an error

Screenshots or Screencasts

Desktop (please complete the following information):

  • MacOS 14.4

Additional context
@thekevinbrown has a pretty good sense of what is probably wrong here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant