Optimization of options function in Select / MultiSelect
#1819
dorianamouroux
started this conversation in
General
Replies: 1 comment
-
|
Hey, thanks for the suggestion! I see the problem. We have a similar issue with the index view when Let me think about the suggested options to address this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Field options functions (like
optionsinMultiSelectorSelect) are called on every form update/event, causing repeated database queries and gives a slow UX:Use Case
A
Bookresource has agenre_idsfield. Options depend on the associatedAuthor'sgenre_idsarray. Currently, genres are queried on every form update, causing performance issues.Proposed Solutions
Option 1: Callback to modify assigns after item loads
Option 2: Allow item_query to return assigns modifications
Option 3: Call options function only once
Cache the options result and reuse it on subsequent form updates:
Benefits
Would this feature be useful for the Backpex community? I'm happy to look into implementation this if the maintainers are open to it!
Beta Was this translation helpful? Give feedback.
All reactions