Skip to content

Conversation

@GuiLeme
Copy link
Collaborator

@GuiLeme GuiLeme commented Jun 3, 2025

What does this PR do?

This PR introduces two main changes:

  1. Adds a new ui-data-getter
    A 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.

  2. Refactors existing ui-data logic
    Updates the previous ui-data-hooks structure to integrate seamlessly with the new ui-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-html-plugin-sdk#188
Updates on the plugin itself: iMDT/bbb-paris-hackdays#5

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 3, 2025

"""

Walkthrough

This set of changes updates the import paths for several constants and types from the bigbluebutton-html-plugin-sdk package across multiple files, reflecting a restructuring of the SDK's internal module organization. The SDK dependency version is updated from 0.0.82 to 0.0.84 in both package.json and the server configuration. The PresentationMenu component is enhanced with a new asynchronous helper function extractSlideContentToImage to centralize slide snapshot extraction and download logic, and a new useEffect hook listens for plugin SDK UI data getter subscription events to dispatch current slide image data for plugin consumption. The snapshot menu item click handler is simplified to use this helper. Additionally, documentation is added describing a new plugin API async function getUiData for fetching UI data on demand without real-time updates.

Sequence Diagram(s)

PresentationMenu: Slide Content Extraction and Plugin Event Dispatch

sequenceDiagram
    participant User
    participant PresentationMenu
    participant WhiteboardAPI
    participant PluginConsumer

    User->>PresentationMenu: Clicks snapshot menu item
    PresentationMenu->>WhiteboardAPI: Get slide shapes and poll shapes
    WhiteboardAPI-->>PresentationMenu: Returns shapes and poll data
    PresentationMenu->>PresentationMenu: extractSlideContentToImage()
    PresentationMenu->>PresentationMenu: Generate image (SVG/PNG)
    PresentationMenu->>User: Initiates file download

    PluginConsumer->>PresentationMenu: Subscribes to UI_DATA_GETTER_SUBSCRIBED event
    PresentationMenu->>PresentationMenu: extractSlideContentToImage()
    PresentationMenu->>PluginConsumer: Dispatches image data as custom event
Loading

Suggested reviewers

  • gustavotrott
  • antonbsa
    """

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df75ea2 and 0ca3014.

⛔ Files ignored due to path filters (1)
  • bigbluebutton-html5/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • bigbluebutton-html5/package.json (1 hunks)
  • bigbluebutton-web/grails-app/conf/bigbluebutton.properties (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • bigbluebutton-html5/package.json
  • bigbluebutton-web/grails-app/conf/bigbluebutton.properties

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx (1)

201-234: Fix misleading function name.

The function name updateUiDataHookPCurrentWhiteboardSVGWithAnnotationsForPlugin contains "SVG" but it actually dispatches PNG data. This is confusing and should be corrected.

-  const updateUiDataHookPCurrentWhiteboardSVGWithAnnotationsForPlugin = async () => {
+  const updateUiDataHookCurrentWhiteboardPNGWithAnnotationsForPlugin = async () => {

Also update the references to this function in lines 225 and 230.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8650b07 and ef36b83.

⛔ Files ignored due to path filters (1)
  • bigbluebutton-html5/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • bigbluebutton-html5/imports/startup/client/intlAdapter.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-form/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/external-video-player/external-video-player-graphql/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/plugins-engine/ui-data-hooks/layout/presentation-area/utils.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx (3 hunks)
  • bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-participants/component.tsx (1 hunks)
  • bigbluebutton-html5/package.json (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Plugin SDK - Match version of html5 package.json with bigbluebutton.properties
bigbluebutton-html5/package.json

[error] 1-1: The bigbluebutton-html-plugin-sdk dependency is pointing to a commit in the SDK's repository, which is not allowed.

⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: install-and-run-bbb-tests (8)
  • GitHub Check: install-and-run-bbb-tests (7)
  • GitHub Check: install-and-run-bbb-tests (6)
  • GitHub Check: install-and-run-bbb-tests (5)
  • GitHub Check: install-and-run-bbb-tests (4)
  • GitHub Check: install-and-run-bbb-tests (3)
  • GitHub Check: install-and-run-bbb-tests (2)
  • GitHub Check: install-and-run-bbb-tests (1)
  • GitHub Check: install-and-run-plugin-tests
🔇 Additional comments (8)
bigbluebutton-html5/imports/startup/client/intlAdapter.tsx (1)

9-9: Import path update aligns with reorganized SDK structure
The path for UI_DATA_LISTENER_SUBSCRIBED has been updated from ui-data-hooks/consts to ui-data/hooks/consts, matching the new module layout in the plugin SDK. This change is consistent with other files and should resolve import errors.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-form/component.tsx (1)

14-15: Consistent SDK import path adjustments
Both UI_DATA_LISTENER_SUBSCRIBED and ChatFormUiDataPayloads imports have been moved to their new locations under ui-data/hooks/consts and ui-data/domain/chat/form/types respectively. This aligns with the SDK restructuring and maintains consistency across components.

bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-participants/component.tsx (1)

3-4: Updated SDK import paths for user-list UI data hooks
The imports for UI_DATA_LISTENER_SUBSCRIBED and UserListUiDataPayloads now point to the reorganized directories (ui-data/hooks/consts and ui-data/domain/user-list/types). This mirrors the changes in other UI-data consumers and should ensure correct resolution.

bigbluebutton-html5/imports/ui/components/plugins-engine/ui-data-hooks/layout/presentation-area/utils.ts (1)

4-5: Align presentation-area hook imports with new SDK layout
LayoutPresentationAreaUiDataPayloads and UI_DATA_LISTENER_SUBSCRIBED have been relocated to ui-data/domain/layout/presentation-area/types and ui-data/hooks/consts respectively. These paths reflect the updated plugin SDK structure and maintain parity with other UI-data hooks.

bigbluebutton-html5/imports/ui/components/external-video-player/external-video-player-graphql/component.tsx (1)

17-19: Import path updates look good.

The import paths have been correctly updated to reflect the new SDK structure, changing from ui-data-hooks to the new ui-data organization.

bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx (3)

6-7: New imports for ui-data-getter functionality.

The imports correctly support the new on-demand data fetching feature as described in the PR objectives.


158-200: Well-implemented image extraction helper function.

The extractSlideContentToImage function properly centralizes the slide content extraction logic with good platform-specific handling for iOS/Safari (SVG) vs other platforms (PNG). The implementation correctly processes both whiteboard shapes and poll shapes.


397-408: Good refactoring using the new helper function.

The snapshot handler has been nicely simplified by using the new extractSlideContentToImage helper function, improving code reusability and maintainability while preserving all the original functionality.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef36b83 and 74a642f.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-playback-record)
🔇 Additional comments (3)
bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx (3)

6-7: Import path updates look consistent with SDK restructuring.

The import paths have been updated to reflect the new module organization in the bigbluebutton-html-plugin-sdk. This aligns with the AI summary indicating SDK restructuring.


201-233: Plugin integration implementation looks solid.

The useEffect hook properly sets up and cleans up the event listener for plugin SDK integration. The error handling with specific log codes and the async event handler implementation are well done.

The event listener name construction using template literals and the proper cleanup in the return function demonstrate good React practices.


397-407: Excellent refactoring of snapshot download logic.

The simplified onClick handler that leverages the new extractSlideContentToImage function is much cleaner and more maintainable than the previous inline implementation. The error handling flow is preserved while eliminating code duplication.

This change significantly improves code maintainability by centralizing the image extraction logic.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
docs/docs/plugins.md (1)

850-850: Use hyphen in “well-defined”
For grammatical accuracy, change “well defined” to “well-defined”:

- As seen for the `useUiData`, the return type is well defined by the enum chosen...
+ As seen for the `useUiData`, the return type is well-defined by the enum chosen...
🧰 Tools
🪛 LanguageTool

[misspelling] ~850-~850: This word is normally spelled with a hyphen.
Context: ...for the useUiData, the return type is well defined by the enum chosen (in other words, nam...

(EN_COMPOUNDS_WELL_DEFINED)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74a642f and 2bdc181.

📒 Files selected for processing (1)
  • docs/docs/plugins.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/docs/plugins.md

[misspelling] ~850-~850: This word is normally spelled with a hyphen.
Context: ...for the useUiData, the return type is well defined by the enum chosen (in other words, nam...

(EN_COMPOUNDS_WELL_DEFINED)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-freeswitch)
  • GitHub Check: build-package (bbb-fsesl-akka)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-learning-dashboard)

Copy link
Collaborator

@lfzawacki lfzawacki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@antobinary antobinary added this to the Release 3.0 milestone Jun 3, 2025
@antobinary
Copy link
Member

Do we need bigbluebutton/bigbluebutton-html-plugin-sdk#188 merged (and released) first?

@GuiLeme
Copy link
Collaborator Author

GuiLeme commented Jun 3, 2025

@antobinary, we do, actually. Once that's merged and published, I'll bump the version here.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 3, 2025

@github-actions
Copy link

github-actions bot commented Jun 3, 2025

Automated tests Summary

All the CI tests have passed!

@TiagoJacobs TiagoJacobs merged commit e531f51 into bigbluebutton:v3.0.x-release Jun 3, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants