feat(uploads-manager): add enableModernizedUploads feature flag to ContentUploader#4571
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughAdds an opt-in ChangesModernized uploads feature flag
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/elements/content-uploader/__tests__/ContentUploader.test.js (1)
775-785: ⚡ Quick winAssert 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
📒 Files selected for processing (4)
scripts/jest/jest.config.jssrc/elements/content-uploader/ContentUploader.tsxsrc/elements/content-uploader/__tests__/ContentUploader.test.jssrc/elements/content-uploader/stories/ContentUploader.stories.js
e7246f1 to
2d34e98
Compare
73fb1e5 to
62792f4
Compare
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
scripts/jest/jest.config.jssrc/elements/content-uploader/ContentUploader.tsxsrc/elements/content-uploader/__tests__/ContentUploader.test.jssrc/elements/content-uploader/stories/ContentUploader.stories.js
62792f4 to
55f3e27
Compare
|
@Mergifyio queue |
☑️ This pull request is already queued |
Merge Queue Status
This pull request spent 37 seconds in the queue, including 4 seconds running CI. Required conditions to merge
|
Summary
enableModernizedUploadsfeature flag prop toContentUploader(defaultfalse).enableModernizedUploads=truerenders the modernized uploads placeholder (@box/uploads-manager).UploadsManagerwhenuseUploadsManager=true,DroppableContentflow when false).@box/uploads-managerin tests.withModernizedUploads).Test plan
yarn test src/elements/content-uploader/__tests__/ContentUploader.test.jswithModernizedUploadsrenders the modernized placeholder path.enableModernizedUploads=false+useUploadsManager=truestill renders legacyUploadsManager.enableModernizedUploads=false+useUploadsManager=falsestill rendersDroppableContent.Notes
ready-to-mergelabel.Summary by CodeRabbit
New Features
Tests
Chores