Skip to content

ref(html5): refactor presentation-uploader toast and modal - #22024

Merged
gustavotrott merged 10 commits into
bigbluebutton:v3.0.x-releasefrom
GuiLeme:enhance-toast-stability
Jan 21, 2025
Merged

gustavotrott merged 10 commits into
bigbluebutton:v3.0.x-releasefrom
GuiLeme:enhance-toast-stability

Conversation

@GuiLeme

@GuiLeme GuiLeme commented Jan 17, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR refactor both the presentation-uploader modal and toast to enhance stability due to some recent minor issues.

In total it:

  • Updates react-toastify js library for version 11.0.2 and makes necessary changes to not break anything;
  • Refactors the logic for updating the Presentation state which was confusing in some points;
  • Also fix some minor lint warnings along the way;

Motivation

Stabilize behaviour of Presentation modal and toast.

How to test

To test, one will need to run npm ci to update the node_modules and then run the html5 service (dev or prod mode), then try as many cases as possible (try edge cases too, in order to see if something unpredicted will break as well).

@coderabbitai

coderabbitai Bot commented Jan 17, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request introduces a series of changes focused on improving the presentation uploader and related components in the BigBlueButton HTML5 client. The modifications primarily involve refactoring components from class-based to functional components, adding disabled state handling, and enhancing user interface interactions. Key changes include refactoring the Right and PresentationDownloadDropdownWrapper components, updating the PresentationUploader component's state management with a new shouldDisableExportButtonForAllDocuments state, and modifying various components to handle disabled states more effectively. Additionally, the changes update GraphQL queries to include a temporary upload ID, modify localization strings for clearer user feedback during the presentation upload process, and upgrade the react-toastify dependency version in package.json.

Possibly related issues

Suggested labels

cla: signed


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (7)
bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/presentation-download-dropdown-wrapper/component.jsx (1)

5-7: Consider using more specific PropTypes for children.

While the component looks good, consider being more specific with the children PropType. Instead of PropTypes.shape({}), you could define the expected structure of the children components.

bigbluebutton-html5/imports/ui/components/common/control-header/right/component.jsx (2)

8-15: Props spreading could override explicit props.

The spread operator {...props} after explicit props could potentially override important properties like disabled. Consider moving it before the explicit props:

-    <Styled.CloseButton
-      disabled={disabled}
-      size="md"
-      color="light"
-      hideLabel
-      circle
-      {...props}
-    />
+    <Styled.CloseButton
+      {...props}
+      disabled={disabled}
+      size="md"
+      color="light"
+      hideLabel
+      circle
+    />

Line range hint 19-28: Add defaultProps for the disabled prop.

Since disabled is an optional boolean prop, it's good practice to provide a default value.

Add this after the propTypes:

Right.defaultProps = {
  disabled: false,
};
bigbluebutton-html5/imports/ui/components/common/control-header/right/styles.js (1)

6-17: Avoid using !important in styles.

While the disabled styles are well-implemented, using !important should be avoided as it makes styles harder to maintain and override when needed. Consider restructuring the CSS specificity instead:

-      background-color: transparent !important;
+      background-color: transparent;

You might need to increase the specificity of the selector if needed, but avoid using !important.

bigbluebutton-html5/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/container.jsx (1)

21-22: LGTM! Consider adding error state handling.

The addition of loading and empty state checks improves component stability. Consider also handling error states for a more robust implementation.

  if (presentationLoading) return null;
  if (!presentations.length) return null;
+ if (error) {
+   console.error('Failed to fetch presentations:', error);
+   return null;
+ }
bigbluebutton-html5/imports/ui/components/whiteboard/queries.ts (1)

63-63: LGTM! Consider adding TypeScript interface.

The addition of uploadTemporaryId field enhances upload tracking. Consider adding a TypeScript interface to define the shape of the presentation object.

interface Presentation {
  uploadTemporaryId: string;
  uploadInProgress: boolean;
  current: boolean;
  // ... other fields
}
bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/component.jsx (1)

183-186: Consider using early return for conditional tooltip.

The conditional tooltip label assignment could be simplified using an early return pattern.

-    let tooltipLabelForDropdown = intl.formatMessage(intlMessages.options);
-    if (disabled) {
-      tooltipLabelForDropdown = intl.formatMessage(intlMessages.optionsUncomplete);
-    }
+    const tooltipLabelForDropdown = disabled
+      ? intl.formatMessage(intlMessages.optionsUncomplete)
+      : intl.formatMessage(intlMessages.options);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a87648a and 0e54900.

⛔ Files ignored due to path filters (1)
  • bigbluebutton-html5/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • bigbluebutton-html5/imports/ui/components/common/control-header/right/component.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/common/control-header/right/styles.js (1 hunks)
  • bigbluebutton-html5/imports/ui/components/common/menu/component.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/common/toast/styles.js (1 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/container.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx (14 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/component.jsx (3 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/presentation-download-dropdown-wrapper/component.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/presentation-download-dropdown-wrapper/styles.js (1 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js (4 hunks)
  • bigbluebutton-html5/imports/ui/components/whiteboard/queries.ts (1 hunks)
  • bigbluebutton-html5/package.json (1 hunks)
  • bigbluebutton-html5/public/locales/en.json (1 hunks)
👮 Files not reviewed due to content moderation or server errors (4)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js
  • bigbluebutton-html5/imports/ui/components/common/menu/component.jsx
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx
  • bigbluebutton-html5/public/locales/en.json
⏰ 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/package.json (2)

104-104: Consider adding package-lock.json changes.

The PR should include updates to package-lock.json to ensure consistent installations across environments.

✅ Verification successful

Package lock file is properly updated

The package-lock.json file in bigbluebutton-html5/ contains the update to [email protected], ensuring consistent installations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if package-lock.json exists and contains the update
fd -t f "package-lock.json" -x grep -l "react-toastify.*11.0.2" {} \;

Length of output: 112


104-104: Verify react-toastify major version upgrade compatibility.

The upgrade from v10 to v11 is a major version bump which may include breaking changes. Please ensure:

  1. Compatibility with React 18 used in the project
  2. Review of the migration guide for any breaking changes
  3. Testing of all toast notifications, especially in the presentation uploader

Run this script to check compatibility and security:

✅ Verification successful

Upgrade to react-toastify v11.0.2 appears safe to proceed

The codebase uses standard toast APIs through a centralized wrapper component, and v11.0.2 is fully compatible with React 18. No security vulnerabilities were found. Recommend testing the following key areas:

  • Presentation upload notifications
  • Video provider notifications
  • Chat notifications
  • Common toast wrapper functionality
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check react-toastify compatibility with React 18 and security advisories

# Check for React 18 compatibility in package metadata
curl -s https://registry.npmjs.org/react-toastify/11.0.2 | jq -r '.peerDependencies'

# Check for any security advisories
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "react-toastify") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

# Check changelog for breaking changes
curl -s https://raw.githubusercontent.com/fkhadra/react-toastify/master/CHANGELOG.md

Length of output: 590


Script:

#!/bin/bash
# Check toast usage patterns and try to get changelog from npm
echo "=== Toast Usage Patterns ==="
rg "toast\." -A 2 --type js --type jsx --type ts --type tsx

echo -e "\n=== Changelog from NPM ==="
curl -s https://registry.npmjs.org/react-toastify/11.0.2 | jq -r '.versions["11.0.2"].description, .versions["11.0.2"].dist.tarball'

Length of output: 370


Script:

#!/bin/bash
# Search for toast usage with better patterns
echo "=== Toast Import Patterns ==="
rg "import.*['\"]react-toastify['\"]" -g "*.{js,jsx,ts,tsx}"

echo -e "\n=== Toast Function Usage ==="
rg "toast\." -g "*.{js,jsx,ts,tsx}"

echo -e "\n=== ToastContainer Component ==="
ast-grep --pattern 'import { $_ } from "react-toastify"'

Length of output: 7648

bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/presentation-download-dropdown-wrapper/styles.js (1)

4-4: LGTM!

The simplified styling is appropriate as the disabled state handling has been moved to the BBBMenu component.

bigbluebutton-html5/imports/ui/components/common/toast/styles.js (1)

35-35: LGTM! Improved close icon positioning.

The addition of align-self: flex-start ensures consistent positioning of the close icon, improving the UI stability.

bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/component.jsx (2)

34-37: LGTM! Clear message for disabled state.

The addition of optionsUncomplete message improves user feedback during upload states.


189-199: Verify disabled state propagation.

The disabled state is correctly propagated to both BBBMenu and Trigger components. However, ensure that the onClick handler is properly prevented when disabled.

✅ Verification successful

Disabled state is properly implemented and propagated.

The disabled state is correctly handled at all levels:

  • BBBMenu prevents menu opening when disabled
  • Disabled state is properly propagated to menu items
  • Click handlers respect the disabled state
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if BBBMenu properly handles disabled state
ast-grep --pattern 'BBBMenu {
  $$$
  disabled={$_}
  $$$
}'

# Check if Trigger component properly handles disabled state
ast-grep --pattern 'Trigger {
  $$$
  disabled={$_}
  $$$
}'

Length of output: 125


Script:

#!/bin/bash
# Search for BBBMenu component definition and usage
ast-grep --pattern '<BBBMenu$$$disabled={$_}$$$>'

# Search for Trigger component definition and usage
ast-grep --pattern '<Trigger$$$disabled={$_}$$$>'

# Search for component files
fd -e jsx -e js "BBBMenu" "Trigger"

# Search for onClick handlers in components
rg -l "onClick" --type js --type jsx

Length of output: 297


Script:

#!/bin/bash
# Find relevant component files
fd -e jsx -e js BBBMenu
fd -e jsx -e js Trigger

# Search for onClick handlers and disabled prop usage
rg -A 3 "onClick" .
rg -A 3 "disabled.*prop" .

# Try different ast-grep pattern
ast-grep --pattern 'const $_ = ({ disabled, $$ }) => {'

Length of output: 71218


Script:

#!/bin/bash
# Search for BBBMenu component definition
fd -e jsx -e js BBBMenu | xargs rg -A 10 "const BBBMenu|class BBBMenu"

# Search for disabled prop usage in BBBMenu files
fd -e jsx -e js BBBMenu | xargs rg -A 5 "disabled.*prop|disabled={|disabled="

Length of output: 3207


Script:

#!/bin/bash
# Search for disabled prop handling in BBBMenu component
rg -A 5 "disabled[^a-zA-Z]" bigbluebutton-html5/imports/ui/components/common/menu/component.jsx

# Search for prop types definition
rg "disabled.*prop" bigbluebutton-html5/imports/ui/components/common/menu/component.jsx

Length of output: 1024

@antobinary antobinary added this to the Release 3.0 milestone Jan 17, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (2)
bigbluebutton-html5/imports/ui/components/common/control-header/right/component.jsx (2)

5-6: Consider destructuring commonly used props for clarity.

While destructuring disabled is good, consider also destructuring other frequently used props like onClick, label, and icon. This would make the component's interface more explicit and help prevent prop spreading issues.

-function Right(props) {
-  const { disabled } = props;
+function Right({ 
+  disabled,
+  onClick,
+  label,
+  icon,
+  ...otherProps
+}) {

Line range hint 19-28: Enhance prop type definitions and documentation.

Consider the following improvements:

  1. Use a more specific type for accessKey instead of any
  2. Add JSDoc comments to document the props
  3. Define defaultProps for boolean flags
+/**
+ * Right component for the control header
+ * @param {Object} props
+ * @param {boolean} props.disabled - Whether the button is disabled
+ * @param {boolean} props.hideLabel - Whether to hide the button label
+ * @param {string} props.accessKey - Keyboard shortcut key
+ * @param {string} props.icon - Icon name to display
+ * @param {string} props.label - Button label text
+ * @param {Function} props.onClick - Click handler
+ */
Right.propTypes = {
  hideLabel: PropTypes.bool,
  disabled: PropTypes.bool,
-  accessKey: PropTypes.any,
+  accessKey: PropTypes.string,
  'aria-label': PropTypes.string,
  'data-test': PropTypes.string,
  icon: PropTypes.string,
  label: PropTypes.string,
  onClick: PropTypes.func,
};

+Right.defaultProps = {
+  disabled: false,
+  hideLabel: false,
+};
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0e54900 and 14101ea.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/common/control-header/right/component.jsx (1 hunks)
🔇 Additional comments (1)
bigbluebutton-html5/imports/ui/components/common/control-header/right/component.jsx (1)

Line range hint 1-28: Overall changes look good!

The refactoring from a class component to a functional component is well-executed and aligns with modern React practices. The addition of the disabled state handling improves the component's stability and user experience.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js (1)

111-112: Verify token request implementation.

The token request now correctly uses the temporaryPresentationId and filename. However, we should ensure error handling for the token request is comprehensive.

Consider adding a timeout handler for the token request:

 return requestPresentationUploadToken(temporaryPresentationId, meetingId, filename)
+  .timeout(TOKEN_TIMEOUT)
   .then((token) => futch(endpoint.replace('upload', `${token}/upload`), opts, onProgress))
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 14101ea and a4dd309.

📒 Files selected for processing (2)
  • bigbluebutton-html5/imports/ui/components/notes/notes-dropdown/service.ts (2 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js (4 hunks)
🔇 Additional comments (5)
bigbluebutton-html5/imports/ui/components/notes/notes-dropdown/service.ts (2)

3-3: LGTM: Added utility import for unique ID generation.

The addition of the uniqueId utility aligns with the refactoring goals for better presentation state management.


30-38: Verify the presentation state update logic.

The changes to the presentation object structure look good, but we should ensure that all consumers of this API are updated to use the new property names (current instead of isCurrent).

bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js (3)

81-82: Improved function signature with explicit parameters.

The addition of explicit filename and temporaryPresentationId parameters improves clarity and type safety.


131-132: LGTM: Updated presentation mapping.

The presentation mapping now correctly uses the new property names (name and presentationId).


292-292: 🛠️ Refactor suggestion

Verify the impact of the new state variable.

The addition of shouldDisableExportButtonForAllDocuments needs to be properly reset after the upload process completes.

Consider adding a state update in the upload completion handler:

 onUpload: (upload) => {
   that.deepMergeUpdateFileKey(id, 'upload', upload);
+  if (upload.done) {
+    that.setState({ shouldDisableExportButtonForAllDocuments: false });
+  }
 },

@gustavotrott

Copy link
Copy Markdown
Contributor

I noticed two differences compared to version 2.7. I know these issues aren’t introduced by your PR, so we can fix them in a separate PR if you prefer:

  1. In 2.7, the “Clear errors” button didn’t depend on a “Confirm” action. In 3.0, if I click “Cancel” instead of “Confirm” when closing the modal, the errors reappear the next time.
  2. In 2.7, a ✅ icon was displayed in the upload toast when the presentation finished uploading. In 3.0, there’s no immediate confirmation—it only shows an alert about the “Current presentation,” which isn’t very helpful when multiple files are uploaded.

  • Video comparing 2.7 and 3.0 behavior:
Screencast.from.2025-01-20.09-20-01.webm

@gustavotrott

Copy link
Copy Markdown
Contributor

When I press the button to start the upload, a toast message appears with the title ‘1 upload complete,’ even though it hasn’t started yet.

1-upload-complete

Co-authored-by: Ramón Souza <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx (1)

Line range hint 517-545: Fix variable declaration and initialization.

The hasUploading variable lacks proper declaration and could lead to unexpected behavior.

- let hasUploading
+ let hasUploading = false;
  merged.forEach(d => {
    if (!d.uploadCompleted || d.uploadInProgress) {
      hasUploading = true;
    }})
🧹 Nitpick comments (2)
bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx (2)

Line range hint 367-449: Consider memoizing filtered presentations for better performance.

The filtering logic is complex and runs on every update. Consider memoizing the filtered results using useMemo if converted to a functional component, or storing in a class instance variable if keeping the class component.

- const presStateFiltered = presState.filter((presentation) => {
+ // If keeping class component
+ this.presStateFiltered = presState.filter((presentation) => {

// Or if converting to functional component
+ const presStateFiltered = useMemo(() => presState.filter((presentation) => {
  // ... existing filter logic ...
- });
+ }), [presState, propPresentations]);

Line range hint 842-884: Consider extracting the disable logic into a separate method.

The export button disable logic could be more readable if extracted into a dedicated method.

+ isExportDisabled(item, disableActions) {
+   return this.state.shouldDisableExportButtonForAllDocuments
+     || item?.exportToChatStatus === 'RUNNING'
+     || !item.uploadCompleted
+     || !!item.uploadErrorMsgKey
+     || !!item.uploadErrorDetailsJson
+     || disableActions;
+ }

  renderPresentationItem(item) {
    const { disableActions, shouldDisableExportButtonForAllDocuments } = this.state;
-   const shouldDisableExportButton = (isExporting
-     || !item.uploadCompleted
-     || hasError
-     || disableActions);
+   const shouldDisableExportButton = this.isExportDisabled(item, disableActions);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a4dd309 and 7b217aa.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx (13 hunks)
🔇 Additional comments (3)
bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx (3)

305-305: LGTM! Good addition of the export button disable state.

The new state variable helps prevent users from exporting presentations while they are still being processed.


337-365: LGTM! Improved state update logic.

The new logic better handles temporary IDs and ensures cleaner state updates when new presentations arrive from GraphQL.


578-611: LGTM! Improved current presentation handling.

The new state update logic in handleCurrentChange is more robust and handles edge cases better.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx (1)

Line range hint 509-537: Fix syntax and optimize the upload check.

There are a few issues in this code segment that could be improved:

  1. Missing semicolon after hasUploading declaration
  2. Inefficient use of forEach for checking uploads

Apply these improvements:

-      let hasUploading
-      merged.forEach(d => {
-        if (!d.uploadCompleted || d.uploadInProgress) {
-          hasUploading = true;
-        }})
+      let hasUploading;
+      const hasUploading = merged.some(d => !d.uploadCompleted || d.uploadInProgress);
🧹 Nitpick comments (2)
bigbluebutton-html5/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/component.jsx (1)

294-294: Consider edge cases in the upload completion check.

The condition p?.totalPages !== 0 might be too strict. A presentation with 0 pages should still be considered "done" if it has completed uploading (e.g., an empty but valid document).

Consider this alternative:

-const presDone = p?.totalPages !== 0 && p?.totalPagesUploaded === p?.totalPages;
+const presDone = p?.totalPages != null && p?.totalPagesUploaded === p?.totalPages;
bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx (1)

329-357: Simplify state update logic for better maintainability.

While the logic is more robust, it's becoming complex and harder to maintain. Consider breaking down the state update logic into smaller, well-named functions.

Consider extracting the filtering logic into a separate function:

+const filterNewPresentations = (propDiffs, presState) => {
+  return presState.filter(
+    (pres) => !propDiffs.some((p) => pres.presentationId === p.uploadTemporaryId
+      || pres.presentationId === p.presentationId),
+  );
+};

-presState = presState.filter(
-  (pres) => !propsDiffs.some((p) => pres.presentationId === p.uploadTemporaryId
-    || pres.presentationId === p.presentationId),
-);
+presState = filterNewPresentations(propsDiffs, presState);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7b217aa and 4f88e04.

📒 Files selected for processing (2)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/component.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx (13 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-uploader/component.jsx (3)

297-297: LGTM! Clear and well-named state variable.

The new state variable follows React naming conventions and has a clear, self-documenting name.


570-603: LGTM! Well-structured state update logic.

The changes improve the robustness of the current presentation handling:

  • Early return for invalid states
  • Proper null checks
  • Clear separation of state update logic

874-876: LGTM! Improved export button disable logic.

The changes enhance the user experience by providing clearer feedback about when export is available.

@GuiLeme

GuiLeme commented Jan 20, 2025

Copy link
Copy Markdown
Contributor Author

@gustavotrott as discussed internally, those suggestions you brought up will be implemented in a near-future PR, and are marked in this issue: #22038. Thank you for those.

@gustavotrott

Copy link
Copy Markdown
Contributor

Well done!!! It's reeeeally better now!

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4f88e04 and 0a5b0e0.

📒 Files selected for processing (1)
  • .github/workflows/automated-tests.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: install-and-run-tests (8)
  • GitHub Check: install-and-run-tests (7)
  • GitHub Check: install-and-run-tests (6)
  • GitHub Check: install-and-run-tests (5)
  • GitHub Check: install-and-run-tests (4)
  • GitHub Check: install-and-run-tests (3)
  • GitHub Check: install-and-run-tests (2)
  • GitHub Check: install-and-run-tests (1)

Comment on lines +403 to +404
working-directory: ./bigbluebutton-tests/playwright
timeout-minutes: 25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Increase the timeout-minutes to at least 40 minutes

The current 25-minute timeout is insufficient based on historical execution times:

  • Recent successful test runs consistently took between 29-37 minutes
  • Setting a 40-minute timeout provides a safe buffer for execution variations
🔗 Analysis chain

Consider increasing the timeout for test execution.

The 25-minute timeout might be insufficient for larger test shards, especially when running on slower runners or when tests include time-consuming scenarios.

Let's analyze the historical test execution times:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check historical test execution times
gh run list --workflow=automated-tests.yml --json duration,conclusion,durationMs --jq '.[] | select(.conclusion=="success") | .durationMs' | sort -n | tail -n 5 | awk '{printf "%.2f minutes\n", $1/60000}'

Length of output: 440


Script:

#!/bin/bash
# Check historical test execution times using correct fields
gh run list --workflow=automated-tests.yml --json conclusion,startedAt,updatedAt --jq '.[] | select(.conclusion=="success") | ([.updatedAt, .startedAt] | map(fromdateiso8601) | .[0] - .[1]) / 60' | sort -n | tail -n 5

Length of output: 249

ACTIONS_RUNNER_DEBUG: true
BBB_URL: https://bbb-ci.test/bigbluebutton/api
BBB_SECRET: bbbci
run: npm run test-chromium-ci -- --shard ${{ env.shard }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

🛠️ Refactor suggestion

Removing retry mechanism requires careful consideration

The codebase has multiple tests marked as @flaky, and the current configuration already uses minimal retries (retries=1) in CI. Removing the retry mechanism completely could significantly increase the failure rate. Instead:

  • Maintain or increase the retry count in the CI environment
  • Consider implementing test-level retry strategies for known flaky tests, especially in modules like whiteboard, presentation, and reconnection tests
🔗 Analysis chain

Verify test stability after removing retry mechanism.

The removal of the retry mechanism might lead to increased test failures if the tests are flaky. Consider implementing test-level retries using Playwright's built-in retry mechanisms instead.

Let's analyze the test failure patterns:

Consider implementing test-level retries using Playwright's built-in retry mechanisms:

-        run: npm run test-chromium-ci -- --shard ${{ env.shard }}
+        run: npm run test-chromium-ci -- --shard ${{ env.shard }} --retries=2
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check recent test failures
gh run list --workflow=automated-tests.yml --json conclusion --jq '[.[] | select(.conclusion=="failure")] | length'

# Check for potential flaky tests in the codebase
rg -g '*.spec.js' -g '*.test.js' 'flaky|intermittent|unstable' ./bigbluebutton-tests/playwright/

Length of output: 3691


Script:

#!/bin/bash
# Check package.json and playwright config for retry settings
rg -g 'package.json' -g 'playwright.config.*' 'retries|retry' ./bigbluebutton-tests/playwright/

# Check test runner implementation for retry logic
rg -g '*.js' 'retries:|retry:|test.retry' ./bigbluebutton-tests/playwright/

Length of output: 255

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@gustavotrott
gustavotrott merged commit 83e58fa into bigbluebutton:v3.0.x-release Jan 21, 2025
antobinary added a commit that referenced this pull request Oct 28, 2026
The 25-minute budget on the Playwright "Run tests" step dates from
November 2023, when it was the timeout of a retry wrapper around a much
smaller suite (724e356); the wrapper went away in #22024 and the
number stayed.

The suite tagged @ci has grown from 71 to 125 tests between 2026-10-07
and 2026-10-28, and Playwright shards by file in contiguous slices, so
shards 2, 7 and 8 now take 22 to 25 minutes on a green run (shard 2 hit
24.9 minutes on a passing run today). One retried flaky test, at a
3-minute test timeout and one retry in CI, is enough to push those
shards past 25 minutes, which is what the recent

    Error: The action 'Run tests' has timed out after 25 minutes.

failures on v4.0.x-develop are.

40 minutes gives the heavy shards headroom while the @ci suite is
trimmed by moving tests to @nightly; it stays well inside GitHub's
6-hour job cap. The Install BBB step keeps its 60 minutes, and the
plugin and legacy-media jobs keep 25 since their test steps finish in
about a minute.
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