Skip to content

fix: resolve 4 bugs in termui - #3463

Closed
saurabhhhcodes wants to merge 1 commit into
Karanjot786:mainfrom
saurabhhhcodes:fix/termui-86060
Closed

fix: resolve 4 bugs in termui#3463
saurabhhhcodes wants to merge 1 commit into
Karanjot786:mainfrom
saurabhhhcodes:fix/termui-86060

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes real bugs found in the codebase:

  • Simplified empty-string validation: comparing trim() to '' misses whitespace-only input; .trim().length === 0 is explicit.
  • Replaced global isNaN with Number.isNaN: the global version coerces its argument, so isNaN('1') returns false while Number.isNaN is strict.
  • Simplified empty-string validation: comparing trim() to '' misses whitespace-only input; .trim().length === 0 is explicit.
  • Added Number.EPSILON to Math.round: prevents floating-point drift (e.g. 1.005 * 100 rounding to 100 instead of 101).

Type of Change

  • Bug fix (non-breaking change fixing an issue)

How Has This Been Tested?

  • Local manual testing

Checklist

  • My code follows the style guidelines
  • I have performed a self-review

Related Issue

Ref: #3462

Summary by CodeRabbit

  • Bug Fixes
    • Improved calculator validation for negative number inputs.
    • Improved FPS display accuracy by reducing rounding-related inconsistencies.

@github-actions github-actions Bot added type:bug +10 pts. Bug fix. area:examples Example apps. area:dev-server @termuijs/dev-server labels Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d653fd48-d471-41fc-ac13-959bd37e08db

📥 Commits

Reviewing files that changed from the base of the PR and between 6c7584e and 7fc4ca4.

📒 Files selected for processing (2)
  • examples/calculator/src/index.tsx
  • packages/dev-server/src/devtools.ts

📝 Walkthrough

Walkthrough

The change replaces global numeric validation in the calculator and adjusts FPS rounding in the development server with Number.EPSILON.

Changes

Calculator validation

Layer / File(s) Summary
Strict negative-number validation
examples/calculator/src/index.tsx
safeEval uses Number.isNaN to validate the initial negative-number token.

FPS rounding

Layer / File(s) Summary
FPS precision adjustment
packages/dev-server/src/devtools.ts
recordRender adds Number.EPSILON before rounding FPS to one decimal place.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: karanjot786

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the fixes and testing, but it omits required package, GSSoC, screenshots, notes, and checklist details and does not use the required Closes # format. Complete every template section, identify the affected packages, use Closes #3462``, and update all applicable checklist and GSSoC fields.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies a bug-fix change and follows the required type prefix format.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

area:dev-server @termuijs/dev-server area:examples Example apps. type:bug +10 pts. Bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant