Skip to content

Conversation

@reneshen0328
Copy link
Contributor

@reneshen0328 reneshen0328 commented Oct 27, 2025

sharingServiceProps will be undefined when the hook is first ran. It'll hit a type error hence return an empty page without this fix.

Summary by CodeRabbit

  • Chores

    • Updated unified-share-modal library to a newer version.
  • Refactor

    • Improved null-safety for sharing service properties.
    • Optimized build process for locale handling.

@reneshen0328 reneshen0328 requested review from a team as code owners October 27, 2025 18:28
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Walkthrough

This PR updates the @box/unified-share-modal dependency to a newer version, adds locale-specific build filtering to skip non-English locales, applies optional chaining to sharing service property access, and removes the children prop from a ContentSharing story variant.

Changes

Cohort / File(s) Summary
Dependency Version Update
package.json
Bumped @box/unified-share-modal from ^0.52.0 to ^1.5.1 in both dependencies and peerDependencies sections
Build Script Enhancement
scripts/buildLocaleAssets.js
Added early return guard in worker thread execution to skip build processing when locale is not 'en-US'
Hook Nullability Improvement
src/elements/content-sharing/hooks/useSharingService.ts
Replaced direct property access with optional chaining for can_set_share_access, can_share, and serverUrl fields in sharing options object
Story Configuration
src/elements/content-sharing/stories/ContentSharing.stories.js
Removed children prop from withContentSharingV2Enabled story variant, commenting out the rendered button element

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The changes are relatively straightforward with consistent patterns (version bumps, guard clauses, optional chaining, prop removal)
  • Heterogeneity across files requires separate reasoning for each change, but individual edits are minor and low-density
  • No complex logic or significant structural modifications

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • jfox-box

Poem

🐰 A modal version hops anew,
Locales trimmed to just en-US brew,
Optional chains keep null at bay,
Stories simplified for the day! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description is essentially empty, containing only "TBD" followed by generic contribution guidelines about merge procedures and labeling. It provides no actual implementation details about the changes being made, the motivation for the fixes, or the expected impact of the modifications. The description fails to communicate what is being fixed or why these changes are necessary, which is critical information for reviewers and future maintainers. Replace "TBD" with a proper description that explains the purpose of each change, particularly: the null-safety improvements in useSharingService.ts, the rationale for the version bump in package.json, the purpose of the locale check in buildLocaleAssets.js, and why the story prop was removed. This will help reviewers understand the intent and scope of the PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix(content-sharing): null sharingServiceProps" is specific and clearly related to a significant part of the changeset, particularly the optional chaining updates in useSharingService.ts that address null-safety for sharingServiceProps. While the PR includes additional changes (version bump, locale guard, story modification), the title captures a real and meaningful aspect of the work. The title uses proper conventional commit format and is neither vague nor generic, making it a valid partial summary of the changes even though it doesn't cover all aspects of the PR.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-null-sharingServiceProps

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
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)
src/elements/content-sharing/stories/ContentSharing.stories.js (1)

18-18: Remove commented-out code.

Commented code in story args should either be removed entirely or kept active. If this is meant as documentation, consider using a JSDoc comment instead.

Apply this diff to remove the commented line:

 export const withContentSharingV2Enabled = {
     args: {
-        // children: <button>Open Unified Share Modal</button>,
         features: {

Or if the children prop is intentionally optional for documentation purposes, use a JSDoc comment:

+    /**
+     * Optional: Pass children to customize the trigger
+     * Example: children: <button>Open Unified Share Modal</button>
+     */
     args: {
-        // children: <button>Open Unified Share Modal</button>,
         features: {

Based on the past review comment requesting a change on this line.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4eae4b and d633227.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • package.json (2 hunks)
  • scripts/buildLocaleAssets.js (1 hunks)
  • src/elements/content-sharing/hooks/useSharingService.ts (1 hunks)
  • src/elements/content-sharing/stories/ContentSharing.stories.js (1 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
scripts/buildLocaleAssets.js

[error] 59-59: Illegal return statement outside of a function

(parse)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Summary
🔇 Additional comments (2)
src/elements/content-sharing/hooks/useSharingService.ts (1)

53-56: LGTM! Safe null handling with optional chaining.

The optional chaining correctly prevents runtime errors when sharingServiceProps is null or undefined, allowing the permissions and serverUrl to gracefully fall back to undefined values.

package.json (1)

143-143: Verify internal package version and breaking changes—v1.5.1 not found in public registries.

The version @box/unified-share-modal@1.5.1 does not exist in public npm registries (latest publicly available is ~0.49.0), indicating this is a private or internal Box package. Without access to the internal package registry or v1.5.1 breaking changes documentation, compatibility cannot be verified.

The codebase uses the package extensively:

  • Type imports in: types.js, convertCollaborators.ts, getAllowedAccessLevels.ts, fetchItem.ts, fetchCurrentUser.ts
  • Component usage in: ContentSharingV2.tsx, SharingModal.js, tests, and stories
  • Optional chaining is present in useSharingService.ts (lines 53–57) for defensive property access

Manually confirm:

  1. The version upgrade path and changelog from Box's internal package registry
  2. Whether all type imports and component prop signatures remain compatible
  3. That optional chaining in useSharingService.ts sufficiently handles any API changes

@mergify mergify bot added the queued label Oct 27, 2025
@mergify mergify bot merged commit 4ea0f83 into master Oct 27, 2025
10 checks passed
@mergify mergify bot deleted the fix-null-sharingServiceProps branch October 27, 2025 20:10
@mergify mergify bot removed the queued label Oct 27, 2025
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