Skip to content

fix: resolve 4 bugs in termui - #3640

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

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

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes real bugs found in the codebase:

  • Removed redundant boolean comparison: x === true is equivalent to x (and x === false to !x), and shorter to read.
  • Replaced global isNaN with Number.isNaN: the global version coerces its argument, so isNaN('1') returns false while Number.isNaN is strict.
  • Prevented interval leak: repeated mounts now clear the previous interval before scheduling a new one.
  • Removed redundant boolean comparison: x === true is equivalent to x (and x === false to !x), and shorter to read.

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: #3639

Summary by CodeRabbit

  • Bug Fixes
    • Improved weather example refresh handling to prevent duplicate refresh timers and maintain consistent five-second updates.
    • Improved rendering reliability so interface updates continue when content is marked for refresh.
    • Strengthened prompt choice validation to handle invalid numeric selections more accurately.

@github-actions github-actions Bot added area:examples Example apps. area:core @termuijs/core area:ui @termuijs/ui labels Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 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: 8f9634f3-573e-46fa-891e-f897de5e8db8

📥 Commits

Reviewing files that changed from the base of the PR and between 6c7584e and 3e7f7a0.

📒 Files selected for processing (3)
  • examples/weather/src/index.tsx
  • packages/core/src/app/App.ts
  • packages/ui/src/prompts.ts

📝 Walkthrough

Walkthrough

The changes manage the weather refresh interval, broaden render-loop rescheduling for truthy dirty states, and use Number.isNaN for prompt choice validation.

Changes

Weather timer management

Layer / File(s) Summary
Refresh timer lifecycle
examples/weather/src/index.tsx
The refresh timer clears window.__interval before assigning a new 5-second interval that calls fetchWeather.

Render scheduling

Layer / File(s) Summary
Dirty-state rescheduling
packages/core/src/app/App.ts
Post-render scheduling now runs when _rootWidget.isDirty is truthy.

Prompt validation

Layer / File(s) Summary
Choice NaN validation
packages/ui/src/prompts.ts
Choice validation now uses Number.isNaN instead of the coercing global isNaN.

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 explains the fixes but omits required package, GSSoC, checklist, and reviewer sections, and does not use the required issue-closing format. Add all required template sections, complete the checklist, identify the affected packages, and change Ref: #3639 to `Closes `#3639.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies a bug-fix change and follows the required type: short description 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.

@github-actions github-actions Bot added the type:bug +10 pts. Bug fix. label Aug 6, 2026
@saurabhhhcodes saurabhhhcodes mentioned this pull request Aug 6, 2026
4 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Aug 7, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core @termuijs/core area:examples Example apps. area:ui @termuijs/ui type:bug +10 pts. Bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant