Lazy-load popover components on interaction
What does this MR do and why?
main loads on every page, and it bundled the user popover and all the issuable popover components up front. I moved them behind dynamic imports, so the browser fetches a popover component only when someone hovers or focuses a link that has one.
The hover and focus listeners still register when the page loads. A shared helper waits for the popover delay, loads the component, and mounts it only if the link is still hovered or focused, still on the page and still has the same URL. Work item attribute popovers now also open on keyboard focus, like user popovers.
In my local test build, the six JavaScript files that main loads went from 13,157,207 to 12,568,433 bytes, 588,774 bytes less. Gzipped, they went from 2,147,667 to 2,078,750 bytes.
References
Closes #246533
Part of &22502
Screenshots or screen recordings
The popovers look the same. The change is in when their code loads.
How to set up and validate locally
- Open an issue with the Network panel open. No popover component chunk should load with the page.
- Hover a user link. The user popover chunk loads after the delay and the popover opens.
- Open a work item drawer and press Tab until a milestone link has focus. The milestone popover loads and opens.
- Move the pointer across a link and off it before the delay. Nothing loads.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.