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

[v3.0.0-beta.32] Has Many - Polymorphic Relationship Field ID Conflicts Across Collections Using PostgreSQL Adapter #6370

Closed
jamesryancooper opened this issue May 15, 2024 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet v3

Comments

@jamesryancooper
Copy link

jamesryancooper commented May 15, 2024

Link to reproduction

No response

Describe the Bug

In a polymorphic relationship field within a 'Posts' collection, selecting an item with a specific ID from one related collection (e.g., Podcasts) causes other items with the same ID from other related collections (e.g., Videos, Images) to disappear from the relationship field options. This behavior occurs even though the items belong to different collections and should not interfere with each other.

To Reproduce

Steps to Reproduce the Behavior:

  1. Define collections with a polymorphic relationship field in a Posts collection relating to Videos, Podcasts, and Images.

    	{
    		name:  'linkedContent',
    		type:  'relationship',
    		relationTo:  ['videos',  'podcasts',  'images'],  // This assumes these collections exist
    		hasMany:  true,
    	},
    
  2. Ensure there are items with overlapping IDs across these collections.

  3. In the Payload admin UI, create a new post and attempt to link content using the linkedContent field.

  4. Select an item from one collection (e.g., Podcast with ID = 1).

  5. Observe that items with the same ID from other collections (e.g., Video ID = 1, Image ID = 1) disappear from the selectable options in the linkedContent field.

Screenshot 2024-05-15 at 9 50 20 AM
Screenshot 2024-05-15 at 9 50 37 AM

Expected Behavior: Items from different collections should not affect the availability of items from other collections in a polymorphic relationship field, regardless of shared IDs.

Payload Version

payload-3-0-0-beta-32

Adapters and Plugins

Adapter: @payloadcms/db-postgres, Database: Supabase (PostgreSQL)

@jamesryancooper jamesryancooper added the status: needs-triage Possible bug which hasn't been reproduced yet label May 15, 2024
@jamesryancooper jamesryancooper changed the title Polymorphic Relationship Field ID Conflicts Across Collections Using PostgreSQL Adapter [v3.0.0-beta.32] Polymorphic Relationship Field ID Conflicts Across Collections Using PostgreSQL Adapter May 15, 2024
@jamesryancooper jamesryancooper changed the title [v3.0.0-beta.32] Polymorphic Relationship Field ID Conflicts Across Collections Using PostgreSQL Adapter [v3.0.0-beta.32] Has Many - Polymorphic Relationship Field ID Conflicts Across Collections Using PostgreSQL Adapter May 15, 2024
@denolfe denolfe added the v3 label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet v3
Projects
None yet
Development

No branches or pull requests

3 participants