- Notifications
You must be signed in to change notification settings - Fork301
Cache lookup_field result to avoid repeated evaluation in inlines#1630
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for PR. I'm just wiring you that I will take a look at this. |
Can you provide more information about the side effects or performance issues? I'm already checking the implementation and I'm trying to find edge cases which I have to test. For example if you have an issue with duplicated SQL queries, provide instructions how to can I replicate because on the demo I'm not able to find anything. |
btw I drafted another PR which will probably fix your issue:#1651 |
For example, i have this inline I add prints in and in each is_json, is_image etc.. Also add prints And in console output: I noticed that lookup_field is called multiple times for the same readonly field (e.g. get_correlation_human), which triggers repeated DB hits within one inline rendering cycle. I intentionally kept the change very localized — without refactoring the overall logic — just to highlight the root cause and avoid breaking anything unintentionally. :)) Your proposed PR looks cleaner and more correct architecturally, but I haven’t had a chance to test it yet. |
I merged this one#1651 Hopefully it fixed your issue. |
Added simple caching for lookup_field() in UnfoldAdminReadonlyField.
Without it, custom computed fields in inlines are re-evaluated multiple times per render, causing performance issues or side effects.