Repository navigation
fix: prevent division by zero in progress bar when requiredRecipientFields is empty - #2855
Conversation
|
@durgeshhhhhhh is attempting to deploy a commit to the Documenso Team Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Prevent invalid progress bar width calculations in document-signing UI when there are no required recipient fields.
Changes:
- Guard progress bar width calculation against division-by-zero when
requiredRecipientFields.length === 0. - Apply the same fix to both desktop/page view and mobile widget progress bars.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx | Adds a zero-length guard to prevent invalid progress width computation. |
| apps/remix/app/components/general/document-signing/document-signing-mobile-widget.tsx | Mirrors the same zero-length guard for the mobile progress bar. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| className="absolute inset-y-0 left-0 bg-primary" | ||
| style={{ | ||
| width: `${100 - (100 / requiredRecipientFields.length) * (recipientFieldsRemaining.length ?? 0)}%`, | ||
| width: `${requiredRecipientFields.length === 0 ? 100 : 100 - (100 / requiredRecipientFields.length) * (recipientFieldsRemaining.length ?? 0)}%`, |
| className="absolute inset-y-0 left-0 bg-primary" | ||
| style={{ | ||
| width: `${100 - (100 / requiredRecipientFields.length) * (recipientFieldsRemaining.length ?? 0)}%`, | ||
| width: `${requiredRecipientFields.length === 0 ? 100 : 100 - (100 / requiredRecipientFields.length) * (recipientFieldsRemaining.length ?? 0)}%`, |
|
Hey there, it looks like you haven't accepted our contributor license agreement yet. In order for us to accept your pull request we ask that you please fill out the CLA: https://documen.so/cla |
|
Deployment failed with the following error: |
Description
When a recipient has zero required fields, the progress bar width formula
100 / requiredRecipientFields.lengthproducesInfinity(orNaN), breaking progress bar rendering in both the mobile widget and desktop sidebar view.Fixes bugs #16 and #17 from issue #2829
Related Issue
Part of #2829
Changes Made
Added a zero-length guard in
document-signing-mobile-widget.tsxto return 100% width when "requiredRecipientFields" is empty
Added the same guard in
document-signing-page-view-v2.tsxforconsistency across both mobile and desktop views
Testing Performed
Reproduced the bug locally: with 0 required fields, console showed
width: NaN%and progress bar appeared empty/brokenAfter fix: console shows
width: 100%and progress bar renders as fully completeTested with 2 required fields: progress bar correctly starts at 0% and fills as fields are completed
Tested on Chrome on macOS
Checklist
Additional Notes
Before fix (progress bar broken —
width: NaN%):After fix (progress bar fully complete —
width: 100%):