Skip to content

feat(uploads-manager): add enableModernizedUploads feature flag to ContentUploader#4571

Merged
mergify[bot] merged 4 commits into
masterfrom
create-feature-flag-in-content-uploader
May 21, 2026
Merged

feat(uploads-manager): add enableModernizedUploads feature flag to ContentUploader#4571
mergify[bot] merged 4 commits into
masterfrom
create-feature-flag-in-content-uploader

Conversation

@dealwith
Copy link
Copy Markdown
Collaborator

@dealwith dealwith commented May 20, 2026

Summary

  • Add a new enableModernizedUploads feature flag prop to ContentUploader (default false).
  • Gate rendering so:
    • enableModernizedUploads=true renders the modernized uploads placeholder (@box/uploads-manager).
    • Otherwise behavior stays the same (UploadsManager when useUploadsManager=true, DroppableContent flow when false).
  • Update Jest config to transform @box/uploads-manager in tests.
  • Add/extend tests for the three render paths and add a Storybook variant (withModernizedUploads).

Test plan

  • Run: yarn test src/elements/content-uploader/__tests__/ContentUploader.test.js
  • In Storybook, verify withModernizedUploads renders the modernized placeholder path.
  • Regression check:
    • enableModernizedUploads=false + useUploadsManager=true still renders legacy UploadsManager.
    • enableModernizedUploads=false + useUploadsManager=false still renders DroppableContent.

Notes

  • This PR is intended as a feature-flagged, non-breaking integration path for modernized uploads.
  • After approvals, follow repo guidance by adding the ready-to-merge label.

Summary by CodeRabbit

  • New Features

    • Modernized uploads UI added to the content uploader, toggleable via a new enableModernizedUploads flag (off by default); Storybook story added showcasing the modernized UI.
  • Tests

    • Added tests verifying the uploader renders legacy, non-manager, or modernized UI based on configuration.
  • Chores

    • Jest transformer configuration updated to transform one additional dependency inside node_modules.

Review Change Stack

@dealwith dealwith requested review from a team as code owners May 20, 2026 13:51
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7cf3b468-d546-4ab9-9ecf-69ec8028be41

📥 Commits

Reviewing files that changed from the base of the PR and between 62792f4 and 55f3e27.

📒 Files selected for processing (4)
  • scripts/jest/jest.config.js
  • src/elements/content-uploader/ContentUploader.tsx
  • src/elements/content-uploader/__tests__/ContentUploader.test.js
  • src/elements/content-uploader/stories/ContentUploader.stories.js

Walkthrough

Adds an opt-in enableModernizedUploads prop to ContentUploader to render a modern UploadsManagerBP UI path, updates Jest to transform @box/uploads-manager, adds tests for conditional rendering, and includes a Storybook story demonstrating the feature.

Changes

Modernized uploads feature flag

Layer / File(s) Summary
Jest module transformation setup
scripts/jest/jest.config.js
Jest transformIgnorePatterns updated to allow transforming @box/uploads-manager from node_modules during tests.
ContentUploader feature flag and render refactor
src/elements/content-uploader/ContentUploader.tsx
Adds enableModernizedUploads?: boolean (default false), imports UploadsManagerBP, refactors render() via renderUploader() to choose between modernized UploadsManagerBP + ThemingStyles, legacy UploadsManager (when useUploadsManager), or DroppableContent + Footer.
Test coverage for conditional rendering
src/elements/content-uploader/__tests__/ContentUploader.test.js
New render() test suite asserts rendering of UploadsManager, DroppableContent, or the modernized placeholder based on enableModernizedUploads and useUploadsManager; test imports added to distinguish variants.
Storybook story for modernized uploads
src/elements/content-uploader/stories/ContentUploader.stories.js
Adds withModernizedUploads story that sets enableModernizedUploads: true.

Sequence Diagram

sequenceDiagram
  participant User
  participant ContentUploader
  participant ThemingStyles
  participant UploadsManagerBP
  participant UploadsManager
  participant DroppableContent

  User->>ContentUploader: mount/render
  ContentUploader->>ContentUploader: check enableModernizedUploads
  alt enabled
    ContentUploader->>ThemingStyles: include theming
    ContentUploader->>UploadsManagerBP: render modern UploadsManagerBP (items=[])
  else disabled
    ContentUploader->>ContentUploader: check useUploadsManager
    alt useUploadsManager true
      ContentUploader->>UploadsManager: render legacy UploadsManager
    else
      ContentUploader->>DroppableContent: render DroppableContent + Footer
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • box/box-ui-elements#4563: Wires ContentUploader to render the new UploadsManagerBP UI and relates to adding @box/uploads-manager as a dependency.

Suggested labels

ready-to-merge

Suggested reviewers

  • tjiang-box
  • tjuanitas
  • olehrybak

Poem

🐇 I hopped into the uploader's gate,
A flag to show a modern state,
Tests watch closely, stories hum,
New manager stands while old ones run,
A little rabbit cheers, "Ship it, chum!"

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: adding a feature flag for modernized uploads to ContentUploader.
Description check ✅ Passed The pull request description is comprehensive, covering summary, test plan with checkboxes, and notes about the feature-flagged integration path.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch create-feature-flag-in-content-uploader

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
src/elements/content-uploader/__tests__/ContentUploader.test.js (1)

775-785: ⚡ Quick win

Assert the modernized component positively (not only legacy absence).

Lines 775-785 only verify that legacy components are absent. Add a positive assertion for the modernized uploads component so the flag contract can’t pass with an accidental null render.

✅ Suggested test hardening
+import { UploadsManager as UploadsManagerBP } from '`@box/uploads-manager`';
 import UploadsManager from '../UploadsManager';
 import DroppableContent from '../DroppableContent';
 ...
             test('should render modernized uploads placeholder when enableModernizedUploads is true', () => {
                 const wrapper = getWrapper({ enableModernizedUploads: true });
+                expect(wrapper.find(UploadsManagerBP)).toHaveLength(1);
                 expect(wrapper.find(UploadsManager)).toHaveLength(0);
                 expect(wrapper.find(DroppableContent)).toHaveLength(0);
             });

             test('should render modernized uploads placeholder even when useUploadsManager is true', () => {
                 const wrapper = getWrapper({ enableModernizedUploads: true, useUploadsManager: true });
+                expect(wrapper.find(UploadsManagerBP)).toHaveLength(1);
                 expect(wrapper.find(UploadsManager)).toHaveLength(0);
                 expect(wrapper.find(DroppableContent)).toHaveLength(0);
             });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/elements/content-uploader/__tests__/ContentUploader.test.js` around lines
775 - 785, The tests only assert legacy components are absent; add a positive
assertion that the modernized uploads component is rendered when
enableModernizedUploads is true. Update both tests that call getWrapper(...) to
also assert presence of the modernized component (e.g.
expect(wrapper.find(ModernizedUploadsPlaceholder)).toHaveLength(1)) or, if the
component is rendered with a test id,
expect(wrapper.find('[data-testid="modernized-uploads"]')).toHaveLength(1); keep
the existing checks for UploadsManager and DroppableContent unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/elements/content-uploader/__tests__/ContentUploader.test.js`:
- Around line 775-785: The tests only assert legacy components are absent; add a
positive assertion that the modernized uploads component is rendered when
enableModernizedUploads is true. Update both tests that call getWrapper(...) to
also assert presence of the modernized component (e.g.
expect(wrapper.find(ModernizedUploadsPlaceholder)).toHaveLength(1)) or, if the
component is rendered with a test id,
expect(wrapper.find('[data-testid="modernized-uploads"]')).toHaveLength(1); keep
the existing checks for UploadsManager and DroppableContent unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ec5001c4-a759-43a4-b1ca-eebba2a731d1

📥 Commits

Reviewing files that changed from the base of the PR and between fa9ccea and e7246f1.

📒 Files selected for processing (4)
  • scripts/jest/jest.config.js
  • src/elements/content-uploader/ContentUploader.tsx
  • src/elements/content-uploader/__tests__/ContentUploader.test.js
  • src/elements/content-uploader/stories/ContentUploader.stories.js

@dealwith dealwith self-assigned this May 20, 2026
@dealwith dealwith changed the title Create feature flag in content uploader feat(uploads-manager): add enableModernizedUploads feature flag to ContentUploader May 20, 2026
Comment thread src/elements/content-uploader/__tests__/ContentUploader.test.js
Comment thread src/elements/content-uploader/__tests__/ContentUploader.test.js Outdated
olehrybak
olehrybak previously approved these changes May 21, 2026
Copy link
Copy Markdown
Contributor

@olehrybak olehrybak left a comment

Choose a reason for hiding this comment

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

LGTM

@dealwith dealwith force-pushed the create-feature-flag-in-content-uploader branch from e7246f1 to 2d34e98 Compare May 21, 2026 09:51
Comment thread src/elements/content-uploader/__tests__/ContentUploader.test.js
@dealwith dealwith removed their assignment May 21, 2026
@dealwith dealwith force-pushed the create-feature-flag-in-content-uploader branch from 73fb1e5 to 62792f4 Compare May 21, 2026 19:39
Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/elements/content-uploader/ContentUploader.tsx`:
- Around line 1302-1307: The modernized branch renders <UploadsManagerBP
items={[]}> while legacy upload lifecycle/queue logic may still run, hiding
active uploads; update the enableModernizedUploads branch in the render path to
either (A) pass the real upload items/state instead of an empty array (use the
same source used by the legacy branch) or (B) disable/short-circuit legacy
queue/upload initialization when enableModernizedUploads is true (e.g., check
enableModernizedUploads before invoking the legacy upload lifecycle or
queue-start functions). Locate references to enableModernizedUploads and
UploadsManagerBP in ContentUploader.render (or the surrounding component
methods) and apply the guard so active uploads are never started/managed by
hidden/empty UploadsManagerBP.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd0b083e-e705-4748-b125-fc5c2b9eb8ca

📥 Commits

Reviewing files that changed from the base of the PR and between e254c3d and 62792f4.

📒 Files selected for processing (4)
  • scripts/jest/jest.config.js
  • src/elements/content-uploader/ContentUploader.tsx
  • src/elements/content-uploader/__tests__/ContentUploader.test.js
  • src/elements/content-uploader/stories/ContentUploader.stories.js

Comment thread src/elements/content-uploader/ContentUploader.tsx
@dealwith dealwith self-assigned this May 21, 2026
@dealwith dealwith force-pushed the create-feature-flag-in-content-uploader branch from 62792f4 to 55f3e27 Compare May 21, 2026 20:51
@dealwith
Copy link
Copy Markdown
Collaborator Author

@Mergifyio queue

@mergify mergify Bot added the queued label May 21, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 21, 2026

queue

☑️ This pull request is already queued

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 21, 2026

Merge Queue Status

  • Entered queue2026-05-21 21:06 UTC · Rule: Automatic strict merge
  • Checks skipped · PR is already up-to-date
  • Merged2026-05-21 21:07 UTC · at 55f3e27000517727c13a8f33ac2c2324c0423a1c · squash

This pull request spent 37 seconds in the queue, including 4 seconds running CI.

Required conditions to merge

@mergify mergify Bot merged commit 16d049b into master May 21, 2026
14 checks passed
@mergify mergify Bot deleted the create-feature-flag-in-content-uploader branch May 21, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants