fix(jsx): log unmount errors instead of silently swallowing them#1758
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe private ChangesunmountApps error logging and export
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/jsx/src/unmountHelpers.test.ts`:
- Around line 10-23: The spy.mockRestore() call at the end of the test only
executes if all preceding expect assertions pass, risking a leaked mock in
subsequent tests if any assertion fails first. Wrap the test logic (from the spy
creation through the expect statements) in a try-finally block to ensure
spy.mockRestore() is always called regardless of whether assertions throw
errors, guaranteeing the console.error mock is properly cleaned up after the
test completes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 402ce3c5-3125-484b-998d-74926f38e783
📒 Files selected for processing (2)
packages/jsx/src/render.tspackages/jsx/src/unmountHelpers.test.ts
|
Updated the test to restore the console.error spy inside a finally block so cleanup always occurs even if an assertion fails. Verified the jsx test suite still passes. |
Description
Fixes a bug in
@termuijs/jsxwhere errors thrown duringapp.unmount()were silently swallowed during cleanup.This change preserves the existing non-throwing cleanup behavior while logging unmount failures for improved observability and debugging. A regression test has been added to verify the behavior.
Related Issue
Closes #1757
Which package(s)?
@termuijs/jsx
Type of Change
type:bug)type:testing)Checklist
needs-starcheck blocks your merge otherwise.bun vitest runbun run buildbun run typecheckCONTRIBUTING.md.type: short description.markDirty()(if your change affects rendering).anytypes without an inline comment explaining why.GSSoC 2026 Participation
https://gssoc.girlscript.org/profile/3652c85d-e890-41f5-a48f-584ed0a7f209Screenshots / Recordings (UI changes)
N/A
Notes for the Reviewer
Previously, unmount errors were caught and ignored using an empty catch block, making cleanup failures difficult to diagnose.
This PR:
Preserves the existing cleanup flow
Logs unmount errors for observability
Adds a regression test ensuring:
Summary by CodeRabbit
Bug Fixes
New Features
unmountAppsutility for reliably unmounting multiple apps.Tests