Extremely slow pagination when collection contains Join field
Describe the Bug
Adding a Join field to a collection impacts the performance of pagination in the View List even if I disable ListColumn and ListFilter.
export const Customers: CollectionConfig = {
...
{
name: 'orders',
type: 'join',
collection: 'orders',
on: 'product',
admin: {
disableListColumn: true,
disableListFilter: true,
},
},
};
Link to the code that reproduces this issue
https://github.com/mfilteau/payload-bugs
Reproduction Steps
- Seed the database (Customers, Products, Orders)
http://localhost:3000/api/seed
-
In the admin panel, go to the Customers collection and navigate between pages
-
Compare that to the Orders collection where there is no Join field.
https://github.com/user-attachments/assets/20e3aafe-2793-46b2-985a-fc2b0e800c6b
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Binaries:
Node: 20.10.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
payload: 3.17.1
next: 15.1.0
@payloadcms/db-mongodb: 3.17.1
@payloadcms/email-nodemailer: 3.17.1
@payloadcms/graphql: 3.17.1
@payloadcms/next/utilities: 3.17.1
@payloadcms/payload-cloud: 3.17.1
@payloadcms/richtext-lexical: 3.17.1
@payloadcms/translations: 3.17.1
@payloadcms/ui/shared: 3.17.1
react: 19.0.0
react-dom: 19.0.0
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 65457
Available CPU cores: 16
I'm having the same issue and after some testing I found an issue where when setting pagination: false on a query for a collection with a join field, the limit field will be ignored and and return everything that matches
Is there a chance that this is related?
New update :) For me the slowness of the payload UI could be solved by adding an index to the relationship field that was joined.
I tried indexing, but it’s not working.
Is there any other workaround for this?
If incase anyone needs, this temporarly solved my issue.
{
name: 'notificationsSent',
type: 'join',
collection: 'notifications',
on: 'contact',
_sanitized: true,
admin: {
allowCreate: false,
},
},
@prathap-puthran - thank you , really helped
I am not 100% comfortable with JoinField. For me it does not load related items from relationship field. Its just shows loading. I have two collection. One product and another prices. Prices has the relationship field to product. but when I want to use the product detail to see the connected prices, it just shows loading.
Hi! Apologies for the long delay in getting a response here, are you still experiencing this behavior on the latest version v3.72.0?
Hi, Its working as expected in two of my recent projects. One is running in 3.50.0 and another 3.66.0, so I assume its also working on 3.72.0
Thank you for confirming! I will close this issue for now as it appears resolved on latest.
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.