Skip to content

Make verbose drag logging opt-in instead of always on - #19

Open
Kebechet wants to merge 2 commits into
AlexNek:mainfrom
Kebechet:fix/debug-logging-opt-in
Open

Make verbose drag logging opt-in instead of always on#19
Kebechet wants to merge 2 commits into
AlexNek:mainfrom
Kebechet:fix/debug-logging-opt-in

Conversation

@Kebechet

Copy link
Copy Markdown

Problem

SortableList.razor.js ships with const DEBUG_MODE = true hardcoded inside init. Every consumer of the package gets a console entry on init plus a full event-object dump on every onUpdate, onRemove, onSelect, onDeselect and onEnd — 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 exported setDebugMode(isEnabled) so it can be switched on from the console or over interop while debugging.

The two console.error calls in init (missing element, missing global Sortable) stay unconditional — those are genuine misconfiguration reports, not tracing.

Copilot AI review requested due to automatic review settings July 25, 2026 17:33
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Kebechet, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 26f50e17-ea9b-481f-be82-2c7148ec9044

📥 Commits

Reviewing files that changed from the base of the PR and between 6b2c5ba and cf7ac79.

📒 Files selected for processing (1)
  • BlazorSortableList.Lib/SortableList.razor.js
✨ 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 debugMode flag defaulting to false.
  • Adds export function setDebugMode(isEnabled) to toggle verbose logging.
  • Replaces DEBUG_MODE checks inside init and event handlers with debugMode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4 to +6
export function setDebugMode(isEnabled) {
debugMode = isEnabled;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants