vaadin / web-components

A set of high-quality standards based web components for enterprise web applications. Part of Vaadin 20+
https://vaadin.com/docs/latest/components
450 stars 83 forks source link

[popover] Popover lazy loading of content #7689

Open knoobie opened 1 month ago

knoobie commented 1 month ago

Describe your motivation

Creating 100x Popover on the server side with rich content - when only a single one is opened by the user on demand - is really bad for performance.

Describe the solution you'd like

Either extend Popover by e.g. allowing to add callbacks as a way to add components only when the popover is opened once or create a LazyLoadingPopover with callbacks.

P.s. The callback might take some time.. server roundtrip + creation of the components.. The Popover on the client side would need some kind of loading state / loading indicator theme that the user knows something is happening. (e.g. open the popup with 3x3rem + a loading icon like shown here https://github.com/vaadin/web-components/issues/842)

Describe alternatives you've considered

No response

Additional context

No response

mstahv commented 12 hours ago

Haven't used Popover yet (I have had the need in the past), but intuitively I'd say the callback based creation of the content (and lazy generation/loading) is the way to go. There can be lot of extra CPU and memory wasted now if the content is generated eagerly (by reading the docs I get this impression).