[go: up one dir, main page]

Skip to content

Prevent "+1 more" for single select tokens

What does this MR do and why?

Prevent "+1 more" for single select tokens.

Bug Fixed
image image

Validity Checks has 3 values:

INACTIVE
ACTIVE
UNKNOWN

🐛 The Bug

When selecting "INACTIVE", it displays Active secret +1 more

const selectedOptions = options.filter(({ id, value }) => selected.includes(id || value));

// ❌ returns true (because "ACTIVE" is inside "INACTIVE")
'INACTIVE'.includes('ACTIVE') 
// So both options got selected, showing "Active secret +1 more"

Solution

Convert single string values to arrays before filtering to ensure exact matches:

// Convert single string to array first
const selectedArray = Array.isArray(selected) ? selected : [selected];
const selectedOptions = options.filter(({ id, value }) => selectedArray.includes(id || value));


// ✅ returns false
['INACTIVE'].includes('ACTIVE')
// Only displays "Inactive secret"

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Samantha Ming

Merge request reports

Loading