Skip to content

fix: prevent crash when removing last dropdown option in removeValue - #2843

Merged
dguyen merged 1 commit into
documenso:mainfrom
Abzaek:fix/dropdown-removevalue-crash
May 22, 2026
Merged

dguyen merged 1 commit into
documenso:mainfrom
Abzaek:fix/dropdown-removevalue-crash

Conversation

@Abzaek

@Abzaek Abzaek commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes bug #6 from the Faultmark scan (issue #2829): removeValue crashes when removing the last item from the dropdown options list.

Root cause

After newValues.splice(index, 1), the code checked newValues[index].value. But newValues[index] is the element that shifted into that position after the splice. If the removed item was the last one, newValues[index] is undefined -> runtime crash.

Fix

Capture the removedValue from currentValues[index].value before the splice, then compare defaultValue against the captured value.

Partially addresses #2829

Bug #6 from Faultmark scan (issue documenso#2829): after splice(index, 1), the code
checked newValues[index].value — but newValues[index] is the element that
shifted into that position. If the removed item was the last one,
newValues[index] is undefined -> runtime crash. The defaultValue was also
never correctly cleared.

Fix: Capture removedValue from currentValues (before splice) for safe
comparison.

Signed-off-by: Abdulazez A. <[email protected]>
@vercel

vercel Bot commented May 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
prd-docs Ignored Ignored May 20, 2026 11:03pm
prd-openpage-api Ignored Ignored May 20, 2026 11:03pm
stg-docs Skipped Skipped May 20, 2026 11:03pm

Request Review

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • coderabbit

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e4cb218e-2ff7-4874-b92a-223a3261ba97

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@vercel
vercel Bot temporarily deployed to Preview – stg-docs May 20, 2026 23:03 Inactive
@Mythie

Mythie commented May 20, 2026

Copy link
Copy Markdown
Collaborator

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

@dguyen dguyen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks

@dguyen
dguyen merged commit 43fe558 into documenso:main May 22, 2026
2 checks passed
scoobs-mystery-bytes pushed a commit to scoobs-mystery-bytes/documenso that referenced this pull request May 30, 2026

This branch was previously deployed

1 inactive deployment
Preview – stg-docs — 872d71d5 Deployed May 20, 2026 by vercel[bot]
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.

3 participants