-
Notifications
You must be signed in to change notification settings - Fork 2.9k
perf(ui): only select the useAsTitle field when fetching the document data of a relationship value #13228
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
Conversation
… data of a relationship value
We've explored this in the past but unfortunately this would be considered a breaking change as users consuming this component might be currently relying on fully populated data. This would have to be made opt-in. |
…to ensure backwards compatability
Thanks for the quick response, @jacobsfletch. I just pushed a commit to make this performance optimization opt-in at the relationship field level via a new |
@jhb-dev I meant opt-in at the component-level, not on the config. Buuut after looking into this further, we only ever dispatch the document ID to the onChange handlers and ultimately form state. We no longer expose the full document data, so I think this is a safe change to make after all! |
…p field to ensure backwards compatability" This reverts commit 71ed479.
Thanks, @jacobsfletch, that's great! I've reverted the commit that added the opt-in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @jhb-dev
…es in RelationshipCell (#13832) ### What? Optimize the `RelationshipProvider` to only select the `useAsTitle` field when fetching documents via the REST API. This reduces payload size and speeds up loading of the related document title in the`RelationshipCell` in the table view. ### Why? Previously, when a document had a relationship field, the full document data was requested in the table view, even though the relationship cell only shows the title in the UI. On large collections, this caused unnecessary overhead and slower UI performance. ### How? Applies a select to the REST API request made in the `RelationshipProvider`, limiting the responses to the `useAsTitle` field only. ### Notes - I’m not entirely sure whether this introduces a breaking change. If it does, could you suggest a way to make this behavior opt-in? - For upload enabled collections, the full document must be requested, because the relationship cell needs access to fields like `mimeType`, `thumbailURL` etc. - I hope we can find a way to get this merged. In the Payload projects I work on, this change has significantly improved list view performance. Similar to #13228
What?
Optimize the relationship value loading by selecting only the
useAsTitle
field when fetching document data via the REST API.Why?
Previously, all fields were fetched via a POST request when loading the document data of a relationship value, causing unnecessary data transfer and slower performance. Only the
useAsTitle
field is needed to display the related document’s title in the relationship UI field.How?
Applied a select to the REST API POST request, similar to how the options list is loaded, limiting the response to the
useAsTitle
field only.Related: #12251