feat: Add Component.sizeSignal() for tracking component size via ResizeObserver#23618
feat: Add Component.sizeSignal() for tracking component size via ResizeObserver#23618
Conversation
Test Results1 264 files - 95 1 264 suites - 95 1h 28m 45s ⏱️ -46s For more details on these failures and errors, see this check. Results for commit 501f5d9. ± Comparison against base commit a5a8666. This pull request removes 1298 and adds 48 tests. Note that renamed tests count towards both.This pull request removes 19 skipped tests and adds 2 skipped tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
|
I'd keep this one on hold until we have refined the big picture related to responsive layouting APIs. Some open questions to consider:
|
|
I would see this as the building block for higher level features |
|
I see it as highly visible API that has the risk of not being a practical building block (e.g. if client-side breakpoints are needed) |
|
The basic building block for server side responsive layout is the ability to get the size of a component and update the view according to that. This is implemented in the signals-cases project https://github.com/vaadin/signals-cases/blob/447ea8fe247d7a729c138502ac7ee331c7995235/src/main/java/com/example/usecase11/UseCase11View.java#L282 and also in Viritin https://github.com/viritin/flow-viritin/blob/v25/src/main/java/org/vaadin/firitin/util/ResizeObserver.java Which are the real concerns here? Sure, you can do client side responsive layouting in other ways, but how is it related to this? |
…zeObserver Adds a lazily-initialized, read-only signal on Component that tracks the element's size using the browser's ResizeObserver API. A per-UI ComponentSizeObserver manages a single shared ResizeObserver instance and dispatches size updates to individual component signals.
709c9d4 to
501f5d9
Compare
|
Extract ResizeObserver setup into a reusable MissingAPI.sizeSignal() method that mirrors the future Component.sizeSignal() API (vaadin/flow#23618). UseCase11View now uses this instead of manual JS setup/teardown.
I'm concerned about polluting the very prominent Would it make sense to introduce this low-level API on the |
Extract ResizeObserver setup into a reusable MissingAPI.sizeSignal() method that mirrors the future Component.sizeSignal() API (vaadin/flow#23618). UseCase11View now uses this instead of manual JS setup/teardown.



Adds a lazily-initialized, read-only signal on Component that tracks the element's size using the browser's ResizeObserver API. A per-UI ComponentSizeObserver manages a single shared ResizeObserver instance and dispatches size updates to individual component signals.