Repository navigation
feat(plugins): Add support for the plugin to unmount on meeting end - #22671
antobinary merged 6 commits into
Conversation
… decide whether to unmount on meeting end.
WalkthroughThe changes introduce a new React functional component, Sequence Diagram(s)sequenceDiagram
participant PM as PresenceManager
participant PTLM as PluginTopLevelManager
participant Hook as useStatePreviousValue
participant EVT as CustomEvent Dispatcher
PM->>PTLM: Render PluginTopLevelManager(currentUserCurrentlyInMeeting)
PTLM->>Hook: Retrieve previous value of currentUserCurrentlyInMeeting
Hook-->>PTLM: Return previous value
alt Value Changed
PTLM->>EVT: Dispatch HookEvents.BBB_CORE_UPDATED_MEETING_STATUS with new status
else No Change
PTLM-->>PTLM: No event dispatched
end
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/utils.tsx (1)
22-23: 🛠️ Refactor suggestionExport as a proper React hook.
After converting the function to a proper React hook, update the export to match the new name.
-export default updateMeetingStatusForPlugin; +export default useUpdateMeetingStatusForPlugin;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx(2 hunks)bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/utils.tsx(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Typescript - compile code
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/utils.tsx
[error] 2-2: error TS2305: Module '"bigbluebutton-html-plugin-sdk"' has no exported member 'MeetingStatusData'.
[error] 4-4: error TS2305: Module '"bigbluebutton-html-plugin-sdk/dist/cjs/core/enum"' has no exported member 'GENERIC_HOOK_PLUGIN'.
[error] 10-10: error TS2339: Property 'BBB_CORE_UPDATED_MEETING_STATUS' does not exist on type 'typeof HookEvents'.
⏰ 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 (2)
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx (2)
166-167: Good refactoring of meeting render condition.Extracting the complex conditional expression into a named constant improves readability and makes the code's intent clearer. This is a good practice.
172-172: Simplified render condition improves code readability.Using the extracted
renderMeetingconstant simplifies the JSX and makes the code more maintainable. Good improvement.
|
|
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/utils.tsx (2)
1-5:⚠️ Potential issueTypeScript import errors need to be fixed.
There are TypeScript compiler errors indicating several imports cannot be resolved:
MeetingStatusDatafrombigbluebutton-html-plugin-sdkGENERIC_HOOK_PLUGINfrombigbluebutton-html-plugin-sdk/dist/cjs/core/enumBBB_CORE_UPDATED_MEETING_STATUSproperty doesn't exist onHookEventsCheck if the SDK exports have changed or if you need to update to a newer SDK version.
🧰 Tools
🪛 GitHub Actions: Typescript - compile code
[error] 2-2: error TS2305: Module '"bigbluebutton-html-plugin-sdk"' has no exported member 'MeetingStatusData'.
[error] 4-4: error TS2305: Module '"bigbluebutton-html-plugin-sdk/dist/cjs/core/enum"' has no exported member 'GENERIC_HOOK_PLUGIN'.
6-21:⚠️ Potential issueHooks usage outside of component context violates React's Rules of Hooks.
Using
useRefinside a utility function breaks React's Rules of Hooks. Hooks must only be called inside:
- React function components
- Custom React hooks (names must start with "use")
This will cause unpredictable behavior as the hook won't maintain state properly between renders.
Convert this to a proper custom React hook:
-const updateMeetingStatusForPlugin = (currentUserCurrentlyInMeeting: boolean) => { +const useUpdateMeetingStatusForPlugin = (currentUserCurrentlyInMeeting: boolean) => { const previousUserCurrentlyInMeeting = useRef(true); + useEffect(() => { if (previousUserCurrentlyInMeeting.current !== currentUserCurrentlyInMeeting) { window.dispatchEvent(new CustomEvent<UpdatedEventDetails<MeetingStatusData>>( HookEvents.BBB_CORE_UPDATED_MEETING_STATUS, { detail: { data: { userCurrentlyInMeeting: currentUserCurrentlyInMeeting, }, hook: GENERIC_HOOK_PLUGIN, }, }, )); + previousUserCurrentlyInMeeting.current = currentUserCurrentlyInMeeting; } + }, [currentUserCurrentlyInMeeting]); };Also, you'll need to update imports to include
useEffectfrom React:-import { useRef } from 'react'; +import { useRef, useEffect } from 'react';The consuming component will need to be updated to use this hook properly.
🧰 Tools
🪛 GitHub Actions: Typescript - compile code
[error] 10-10: error TS2339: Property 'BBB_CORE_UPDATED_MEETING_STATUS' does not exist on type 'typeof HookEvents'.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx(2 hunks)bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/utils.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx
🧰 Additional context used
🪛 GitHub Actions: Typescript - compile code
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/utils.tsx
[error] 2-2: error TS2305: Module '"bigbluebutton-html-plugin-sdk"' has no exported member 'MeetingStatusData'.
[error] 4-4: error TS2305: Module '"bigbluebutton-html-plugin-sdk/dist/cjs/core/enum"' has no exported member 'GENERIC_HOOK_PLUGIN'.
[error] 10-10: error TS2339: Property 'BBB_CORE_UPDATED_MEETING_STATUS' does not exist on type 'typeof HookEvents'.
⏰ 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)
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx(2 hunks)bigbluebutton-html5/imports/ui/components/meeting-status-update/component.tsx(1 hunks)bigbluebutton-html5/imports/ui/components/meeting-status-update/types.ts(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Typescript - compile code
bigbluebutton-html5/imports/ui/components/meeting-status-update/component.tsx
[error] 2-2: error TS2305: Module '"bigbluebutton-html-plugin-sdk"' has no exported member 'MeetingStatusData'.
[error] 4-4: error TS2305: Module '"bigbluebutton-html-plugin-sdk/dist/cjs/core/enum"' has no exported member 'GENERIC_HOOK_PLUGIN'.
[error] 15-15: error TS2339: Property 'BBB_CORE_UPDATED_MEETING_STATUS' does not exist on type 'typeof HookEvents'.
⏰ 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 (6)
bigbluebutton-html5/imports/ui/components/meeting-status-update/types.ts (1)
1-3: Clean and well-structured interface definition.The interface is clearly named and follows TypeScript best practices with a descriptive property name. This type definition provides good structure for the component props.
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx (3)
19-19: Good addition of import statement.This import correctly references the new component that will handle meeting status updates for plugins.
166-167: Improved code clarity with descriptive variable name.Extracting this condition into a named variable improves readability and makes the code more maintainable. The variable name
userCurrentlyInMeetingclearly communicates its purpose, which is better than the previous inline condition approach.
170-174: Good implementation of the new component.The component is correctly placed within the JSX structure and receives the appropriate prop. The refactoring of the conditional rendering to use the new variable makes the code more readable.
bigbluebutton-html5/imports/ui/components/meeting-status-update/component.tsx (2)
8-10: Good component declaration with proper TypeScript typing.The component declaration correctly uses the
React.FCtype with the defined props interface. The destructuring of props is also implemented correctly.
27-30: Component correctly returns null.Since this component's purpose is to handle side effects (dispatching events) rather than rendering UI elements, returning null is appropriate.
ef15d34 to
e28d862
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
bigbluebutton-html5/imports/ui/components/plugin-top-level-manager/component.tsx (1)
22-22: Consider renaming to match PR objectives feedback.In the PR comments, user gustavotrott suggested renaming this property to improve clarity. The current name
userCurrentlyInMeetingis good, but for consistency with the interface prop name, consider using the same terminology.- userCurrentlyInMeeting: currentUserCurrentlyInMeeting, + currentUserCurrentlyInMeeting: currentUserCurrentlyInMeeting,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx(2 hunks)bigbluebutton-html5/imports/ui/components/plugin-top-level-manager/component.tsx(1 hunks)bigbluebutton-html5/imports/ui/components/plugin-top-level-manager/types.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx
🧰 Additional context used
🪛 GitHub Actions: Typescript - compile code
bigbluebutton-html5/imports/ui/components/plugin-top-level-manager/component.tsx
[error] 2-2: error TS2305: Module '"bigbluebutton-html-plugin-sdk"' has no exported member 'MeetingStatusData'.
[error] 4-4: error TS2305: Module '"bigbluebutton-html-plugin-sdk/dist/cjs/core/enum"' has no exported member 'GENERIC_HOOK_PLUGIN'.
[error] 18-18: error TS2339: Property 'BBB_CORE_UPDATED_MEETING_STATUS' does not exist on type 'typeof HookEvents'.
⏰ 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 (1)
bigbluebutton-html5/imports/ui/components/plugin-top-level-manager/types.ts (1)
1-3: Interface definition looks clean and appropriate.The
PluginTopLevelManagerPropsinterface is well-defined with a clear property name that accurately represents its purpose. It follows TypeScript best practices for interface naming and property definition.
|
|
Just converted to draft until the SDK PR is Merged and has it's version bumped. |
|
This pull request has conflicts ☹ |
|
Looks like the SDK PR was merged. Please resolve the conflict and we can have it in. |
…lugin-on-meeting-end
|
Automated tests Summary✅ All the CI tests have passed! |



What does this PR do?
This PR basically creates a way for the plugin to decide whether to unmount when the meeting is ended or the user is ejected.
Motivation
This PR fixes the problem where the pick-random-user modal continues open when meeting terminates (if it was open before).
A subsequent PR is going to be sent to the pick-random-user plugin repo implementing this function.
It's worth mentioning that if, for any reason, the plugin dev doesn't want to terminate the plugin once the meeting is over, that's still possible, once this function is not even mandatory.
How to test
Use this branch to test the pick-random-user:
More
Closely related to SDK PR bigbluebutton/bigbluebutton-html-plugin-sdk#157
Closely related the Plugin PR: bigbluebutton/bbb-plugin-pick-random-user#31
Just a reminder: Don't merge it until the SDK's PR is merged and the version is bumped
See demo ahead:
fix_plugin_unmount.mp4