fix(frontend): correct inverted amount validation error condition (#551)#609
Merged
ogazboiz merged 1 commit intoJun 1, 2026
Merged
Conversation
The create-stream amount error rendered with !validateAmountInput(...), which is truthy when the input is VALID — so the error showed for good input and hid for bad input. Render it when validateAmountInput returns a non-null message and display that message instead of a hardcoded string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The create-stream amount field's inline error used an inverted condition: it rendered when
!validateAmountInput(...)was truthy. SincevalidateAmountInputreturns an error string when invalid andnullwhen valid,!validateAmountInput(...)is truthy exactly when the input is valid — so the red error showed for good input and hid for bad input. This corrects the condition and shows the actual validation message.Type of Change
Related Issues
Closes #551
Changes Made
frontend/src/app/streams/create/page.tsx: compute the validation result once into a derivedamountError(nullwhen valid, message when invalid) and render the error only when it is non-null, displaying the returned message instead of a hardcoded string. Kept the "only after the user types" behavior (the empty case is already handled by the submit handler, which toasts "Amount is required"), so the pristine field is not nagged on load.Testing
npx vitest run→ 74/74 passnpx tsc --noEmit→ 0 errorsnpm run lint→ 0 errors (5 pre-existing warnings in untouched files)amountErrorfor each input:validateAmountInput0/0.0010.5)nullTest Coverage
Test Steps
/streams/createand focus the Amount field.10) → no red error.0→ red error "Amount must be greater than 0".Screenshots/Demo
Not attached: one-line conditional fix, no visual restyling, and the app's build fetches Google Fonts at build time which is blocked in my sandbox. Behavior is described in Test Steps.
Checklist
Additional Notes
Branch
fix/create-stream-amount-error-551; conventional commit; out-of-scope wizard amount step left untouched per the issue.