next-admin icon indicating copy to clipboard operation
next-admin copied to clipboard

[FEATURE] - Performance Optimization for relation fields

Open ogoldberg opened this issue 1 year ago • 2 comments

Summary

on the edit view, when selecting a relation field, if there are a lot of records it takes a really long time to load the options. Wondering if there could be some kind of async pre-fetch operation, maybe a cache, maybe pagination, maybe all of the above?

Basic Example

on the edit view, when selecting a relation field, if there are a lot of records it takes a really long time to load the options. Wondering if there could be some kind of async pre-fetch operation, maybe a cache, maybe pagination, maybe all of the above?

Drawbacks

I understand needing to balance keeping the data dynamic while also keeping it fast, and also keeping search as simple as possible. It's a tough problem to solve.

Unresolved questions

No response

ogoldberg avatar Jun 07 '24 17:06 ogoldberg

We are already applying pagination to the search field (see https://github.com/premieroctet/next-admin/blob/main/packages/next-admin/src/actions/resources.ts#L52)

We will have a look at it

foyarash avatar Jun 10 '24 08:06 foyarash

The relationship field indeed uses the pre-fetch operation for the first batch, cache and pagination.

If you're still struggling with that, please provide us with more information about your schema.

As we had done with issue #343 we have tried to reproduce the issue by using a huge amount of data, and huge plain text fields, without success.

Let us know about your situation 🚀

cregourd avatar Jul 01 '24 14:07 cregourd