Skip to content

Fix order form rejecting price=0#374

Merged
crthpl merged 1 commit intomainfrom
fix-price-zero
Mar 8, 2026
Merged

Fix order form rejecting price=0#374
crthpl merged 1 commit intomainfrom
fix-price-zero

Conversation

@crthpl
Copy link
Copy Markdown
Contributor

@crthpl crthpl commented Mar 8, 2026

Summary

  • The order entry form used JavaScript truthiness checks (!bidPrice, bidPrice ? ...) which treat 0 the same as empty/null/undefined
  • This caused three issues when entering price=0: submit button was disabled, order book highlighting was broken, and validation errors wouldn't clear
  • Added a hasValue() helper that explicitly checks for empty string and null, correctly treating 0 as a valid input

Test plan

  • Create a market with min_settlement=0 (e.g., 0–100)
  • Enter price=0 for a bid or offer — verify the submit button is enabled and the order submits successfully
  • Verify order book highlighting works correctly when price=0 is entered
  • Verify that non-zero prices still work as before

The order entry form used truthiness checks (e.g. !bidPrice, bidPrice ? ...)
which treat 0 the same as empty/null. This disabled the submit button,
broke order highlighting, and prevented error clearing when price was 0.

Replace all affected checks with an explicit hasValue() helper.
@crthpl crthpl requested a review from a team as a code owner March 8, 2026 19:19
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 8, 2026

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

Project Deployment Actions Updated (UTC)
platform Ready Ready Preview, Comment Mar 8, 2026 7:20pm

Request Review

@crthpl crthpl merged commit 89d0da3 into main Mar 8, 2026
5 checks passed
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.

1 participant