fix: always call timeEnd after timeLog in createDebugger when inspect is true#143
fix: always call timeEnd after timeLog in createDebugger when inspect is true#143vinamra1102 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes a timer leak in ChangesTimer Cleanup Fix for Debug Inspect Mode
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 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 |
|
CI workflow is awaiting approval ,could a maintainer please |
What does this PR fix?
createDebuggerinsrc/debugger.tscallsconsole.timeLog()in theafterEachhandler wheninspect: truebut never callsconsole.timeEnd().This causes every hook call to leak a console timer. On the second call to
the same hook the browser warns:
Since
inspectdefaults totruein browsers, every browser user ofcreateDebuggeris affected.Root cause
console.timeEnd()was inside theelsebranch of theinspectcheck,so it was never reached when
inspect: true. The timer started byconsole.time()inbeforeEachwas never ended.Fix
Moved
console.timeEnd()outside theif/elseblock so it always runsregardless of
inspectvalue.console.timeLog()still only runs wheninspect: true.Before:
After:
Tests added
should end timer when inspect is true— assertsconsole.timeEndis called with the hook label
should not leak timers when calling same hook twice with inspect—asserts
console.timeandconsole.timeEndare each called exactlytwice with no leaked timers
Fixes #142
Summary by CodeRabbit
Bug Fixes
Tests