Skip to content

[Bug]: Creating a new many-to-many relation does not create the junction record #1784

@chawes13

Description

@chawes13

Contact Details

No response

What happened?

From an association's page, create a new record.

E.g., User, Group, and GroupUser. From user, create a new group and automatically have that user associated to it through GroupUser.

My junction table does have a primary key and it is not a composite key.

Expected Result
The new group is created, as well as an entry for the user.

Actual Result
The new group is created, but no users are associated to it.

Misc.
I see the following in my url /admin/resources/Group/actions/new?user=2db1e0c7-85f1-4726-b856-c035d2cd5096&junctionResourceId=GroupUser&joinKey=user&inverseJoinKey=group&redirectUrl=http%3A%2F%2Flocalhost%3A3000%2Fadmin%2Fresources%2FUser%2Frecords%2F2db1e0c7-85f1-4726-b856-c035d2cd5096%2Fshow%3Ftab%3Dgroups

Bug prevalence

Always

AdminJS dependencies version

adminjs 7.5.12
@adminjs/relations 1.1.2 and 1.1.0 (pinned the latter as a result of #1743)
@adminjs/prisma 5.0.4

What browsers do you see the problem on?

Microsoft Edge, Chrome, Safari, Firefox

Relevant log output

[prisma]: Query: INSERT INTO "public"."Group" ("id","name","description") VALUES ($1,$2,$3) RETURNING "public"."Group"."id", "public"."Group"."name", "public"."Group"."description"

Relevant code that's giving you issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions