no-hup commented on PR #43990:
URL: https://github.com/apache/superset/pull/43990#issuecomment-5715953026

   Good catch, you're right. `get_charts_for_dashboard` returned 
`dashboard.slices` after the prefetch, so when the collection started unloaded 
the prefetched charts had nothing keeping them alive — the return reloaded them 
with editors/viewers unloaded again and paid the per-chart queries.
   
   Fixed in 566366b: hold `charts = dashboard.slices` before prefetching and 
return that same list, so the prefetched relationships stay on the instances 
the caller reads.
   
   Added a regression test 
(`test_get_charts_for_dashboard_returns_the_prefetched_charts`) along the lines 
of your reproduction: it seeds a dashboard, expunges the session so the lookup 
returns it with slices unloaded, runs it through the helper, then counts 
statements while reading the returned charts' editors/viewers. It's 0 with the 
reorder, and I checked it fails on the old ordering. The dao test file is 7 
passed locally — unit tests only, I didn't run the integration/Postgres suite.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to