Skip to content

fix: guard against div-by-zero and clamp over-distributed milestones - #135

Open
rafaio1 wants to merge 1 commit into
MergeFi:mainfrom
rafaio1:fix/issue-75-milestone-div-zero
Open

rafaio1 wants to merge 1 commit into
MergeFi:mainfrom
rafaio1:fix/issue-75-milestone-div-zero

Conversation

@rafaio1

@rafaio1 rafaio1 commented Aug 20, 2026

Copy link
Copy Markdown

Fixes #75.

MilestonesPage was computing funding progress as distributed / budget without guarding against budget === 0, producing NaN or Infinity that silently collapsed the progress bar or displayed a misleading '0%'. Additionally, the text readout (formatPercent) was unclamped while the bar was clamped to 100%, causing visual disagreement for over-funded milestones.

Replaced the unsafe division with a hasBudget guard. When budget is 0, the UI now explicitly renders 'Not yet funded'. When distributed exceeds budget, the bar turns amber and the text readout honestly reports the over-distributed percentage instead of capping it invisibly.

Fixes MergeFi#75.

MilestonesPage was computing funding progress as distributed / budget
without guarding against budget === 0, producing NaN or Infinity that
silently collapsed the progress bar or displayed a misleading '0%'.
Additionally, the text readout (formatPercent) was unclamped while the
bar was clamped to 100%, causing visual disagreement for over-funded
milestones.

Replaced the unsafe division with a hasBudget guard. When budget is 0,
the UI now explicitly renders 'Not yet funded'. When distributed exceeds
budget, the bar turns amber and the text readout honestly reports the
over-distributed percentage instead of capping it invisibly.
@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

MilestonesPage divides by zero on an unfunded budget and never clamps an over-100% distributed percentage

1 participant