feat: New ui-data-getter and refactor of ui-data's #188
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR introduces two main changes:
Adds a new
ui-data-getterA utility to fetch UI data on demand — unlike existing reactive hooks, this does not automatically update when data changes. It fetches the current data only when explicitly requested.
Refactors existing
ui-datalogicUpdates the previous
ui-data-hooksstructure to integrate seamlessly with the newui-data-getter. Both now align under a shared goal: providing access to UI-related information, but with different update strategies (on-demand vs. reactive).Why is this needed?
A key use case is retrieving a snapshot of the current slide with annotations. Doing this reactively (i.e., every time a new annotation is added) would be inefficient — especially in scenarios like a live class with multiple students making changes simultaneously.
This new approach avoids unnecessary computation by allowing a one-time fetch when needed.
Additionally, this design lays the groundwork for flexibility: if reactivity is later desired for specific data (e.g.,
presentation-whiteboard-current-slide), we can easily expose it as a hook with minimal changes to the core and SDK.Motivation
As part of the La Suite Numérique docs integration, we need to append a base64-encoded PNG snapshot of the current slide at the end of the document. This feature supports that requirement cleanly and efficiently.
More
Closely related to bigbluebutton/bigbluebutton#23314