premieroctet / next-admin

▲ Full-featured admin for Next.js and Prisma
https://next-admin.js.org
MIT License
244 stars 7 forks source link

[FEATURE] - Performance Optimization for relation fields #342

Open ogoldberg opened 4 weeks ago

ogoldberg commented 4 weeks ago

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

foyarash commented 3 weeks ago

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

cregourd commented 4 days ago

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 🚀