Skip to content

fix: support decimal multivariate variation weights#7672

Open
SahilJat wants to merge 1 commit into
Flagsmith:mainfrom
SahilJat:fix/multivariate-decimal-weights
Open

fix: support decimal multivariate variation weights#7672
SahilJat wants to merge 1 commit into
Flagsmith:mainfrom
SahilJat:fix/multivariate-decimal-weights

Conversation

@SahilJat
Copy link
Copy Markdown
Contributor

@SahilJat SahilJat commented Jun 2, 2026

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes #7671

This PR enables support for decimal/fractional values in multivariate variation weights within the dashboard.

Key updates:

  • Updated VariationValueInput.tsx to use a number input type with step="any", allowing for decimal entry.
  • Replaced parseInt with parseFloat in the variation weight change handler to ensure decimal values are preserved in the state.
  • Updated the calculateControl utility in utils.tsx to round the calculated control remainder to 2 decimal places, preventing floating-point precision artifacts (e.g., 0.09999999999999432) from appearing in the UI.

How did you test this code?

  • Manual Verification: Verified that decimal weights (e.g., 0.1 and 99.9) can now be entered and saved through the dashboard without being rounded to integers.
  • UI Logic Verification: Confirmed that the "Control Value" percentage correctly calculates and displays as a clean decimal (e.g., 0.1%) when other variations total 99.9%.
  • Regression Testing: Reviewed existing E2E test patterns to ensure that switching from type="text" to type="number" does not break existing automation that interacts with these fields.

@SahilJat SahilJat requested a review from a team as a code owner June 2, 2026 09:35
@SahilJat SahilJat requested review from talissoncosta and removed request for a team June 2, 2026 09:35
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

@SahilJat is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Jun 2, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

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

Project Deployment Actions Updated (UTC)
flagsmith-frontend-staging Ready Ready Preview, Comment Jun 4, 2026 9:17pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multivariate variation weights cannot be set to decimal/fractional values in the dashboard

2 participants