-
Notifications
You must be signed in to change notification settings - Fork 2.9k
perf(ui): use select API in RelationshipProvider to speed up load times in RelationshipCell #13832
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
perf(ui): use select API in RelationshipProvider to speed up load times in RelationshipCell #13832
Conversation
…s in the RelationshipProvider
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.
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?
This would be a breaking change if someone were using the useListRelationships
hook, e.g. #8568 — but we can just make this conditional based on the new enableListViewSelectAPI
property.
Also quick response here:
There might be a way to determine upload-specific fields and only select those. Worth exploring. |
Thanks for the prompt response, @jacobsfletch. I just made the requested changes! |
const fieldToSelect = collection.admin.useAsTitle ?? 'id' | ||
select[fieldToSelect] = true | ||
|
||
if (collection.upload) { |
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.
@jhb-dev we could remove this line (L78), the helper util already checks this condition internally.
What?
Optimize the
RelationshipProvider
to only select theuseAsTitle
field when fetching documents via the REST API. This reduces payload size and speeds up loading of the related document title in theRelationshipCell
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 theuseAsTitle
field only.Notes
mimeType
,thumbailURL
etc.Similar to #13228