MouhibKhammassi opened a new pull request, #38927: URL: https://github.com/apache/superset/pull/38927
fix(explore): prevent repeated UI freeze on "Download as image" ### SUMMARY `styleCache` is a module-scoped `WeakMap` in `downloadAsImage.tsx` that caches `getComputedStyle` results across downloads. A single erroneous `styleCache.delete?.(originalElement)` call in the `cleanup` callback was evicting the cache entry after every download, forcing a full style recalculation on every subsequent download of the same chart. Removed that line. The WeakMap releases entries automatically via GC when the element is no longer reachable.no manual eviction is needed. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A. the change is not visually observable in the UI itself. The difference is measurable via the Performance tab in browser DevTools: before the fix, `getComputedStyle` recalculation events appear on every download; after the fix, they are absent from the second download onward. ### TESTING INSTRUCTIONS 1. Open a dashboard with a complex chart (table with 50+ rows). 2. Click **Download as image**. Note the duration of the UI freeze. 3. Without refreshing, click **Download as image** on the same chart again. 4. Confirm the second download is noticeably faster than the first. 5. Confirm both downloaded images are correct. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [x] Changes UI. visible freeze on repeated image downloads is reduced - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
