adminjs icon indicating copy to clipboard operation
adminjs copied to clipboard

[Bug]: The documentation of the @adminjs/relatoins example is incorrect

Open tonypinkevych opened this issue 1 year ago • 0 comments

Contact Details

https://discord.com/channels/1134390757755723816/1134399045155180554/1286417341923459103

What happened?

Please update the documentation for your paid @adminjs/relations plugin with the @adminjs/prisma adapter. It has a very unclear behavior.

In your documentation there is an example of options for a resource where you explicitly specify users organizationId and personId:

Screenshot 2024-09-19 at 21 57 55

But it doesn't work and returns very unclear behavior (infinite bootloader) and an error message:

Screenshot 2024-09-19 at 21 59 54 Screenshot 2024-09-19 at 22 00 13

Instead of organizationid it should just point to organization.

Screenshot 2024-09-19 at 21 58 31

Related to this: https://github.com/SoftwareBrothers/adminjs/issues/1619

Bug prevalence

At first interaction with paid plugin

AdminJS dependencies version

"@adminjs/express": "^6.1.0"
"@adminjs/nestjs": "^6.1.0"
"@adminjs/prisma": "^5.0.3"
"@adminjs/relations": "^1.1.2"

What browsers do you see the problem on?

Chrome

Relevant log output

[22:00:07.338] ERROR (31474): Cannot read properties of null (reading 'type')
    err: {
      "type": "TypeError",
      "message": "Cannot read properties of null (reading 'type')",
      "stack":
          TypeError: Cannot read properties of null (reading 'type')
              at file:///Users/tonypinkevych/Documents/education/node_modules/@adminjs/prisma/src/utils/converters.ts:39:84
              at Array.reduce (<anonymous>)
              at convertFilter (file:///Users/tonypinkevych/Documents/education/node_modules/@adminjs/prisma/src/utils/converters.ts:38:34)
              at Resource.find (file:///Users/tonypinkevych/Documents/education/node_modules/@adminjs/prisma/src/Resource.ts:88:14)
              at oneToManyHandler (file:///Users/tonypinkevych/Documents/education/node_modules/@adminjs/relations/lib/actions/one-to-many/one-to-many.handler.js:1:607)
              at file:///Users/tonypinkevych/Documents/education/node_modules/@adminjs/relations/lib/actions/relations.handler.js:1:727
              at file:///Users/tonypinkevych/Documents/education/node_modules/adminjs/lib/backend/decorators/action/action-decorator.js:98:90
    }

Relevant code that's giving you issues

Can be taken from this example: https://docs.adminjs.co/basics/features/relations. Just copy paste into a project and it doesn't work

tonypinkevych avatar Sep 19 '24 20:09 tonypinkevych