Make verbose drag logging opt-in instead of always on - #19
Conversation
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ 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.
Pull request overview
This PR makes the verbose drag/drop console logging in SortableList.razor.js opt-in (disabled by default) by moving the debug flag to module scope and exposing a setter to toggle it during debugging.
Changes:
- Introduces a module-scoped
debugModeflag defaulting tofalse. - Adds
export function setDebugMode(isEnabled)to toggle verbose logging. - Replaces
DEBUG_MODEchecks insideinitand event handlers withdebugMode.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export function setDebugMode(isEnabled) { | ||
| debugMode = isEnabled; | ||
| } |
There was a problem hiding this comment.
Fixed, though slightly stricter than suggested: !!isEnabled would still enable logging for the string "false", which was the case raised. setDebugMode now matches true or "true" explicitly.
Problem
SortableList.razor.jsships withconst DEBUG_MODE = truehardcoded insideinit. Every consumer of the package gets a console entry on init plus a full event-object dump on everyonUpdate,onRemove,onSelect,onDeselectandonEnd— in production, with no way to turn it off short of patching the shipped asset. Logging whole event objects also retains them, which is avoidable overhead on drag-heavy pages.Implementation
Moved the flag to module scope, defaulted it to
false, and exportedsetDebugMode(isEnabled)so it can be switched on from the console or over interop while debugging.The two
console.errorcalls ininit(missing element, missing globalSortable) stay unconditional — those are genuine misconfiguration reports, not tracing.