Skip to content

fix: process is not defined in browser environment (#806)#810

Open
xfournet wants to merge 1 commit into
react-grid-layout:masterfrom
xfournet:fix-806
Open

fix: process is not defined in browser environment (#806)#810
xfournet wants to merge 1 commit into
react-grid-layout:masterfrom
xfournet:fix-806

Conversation

@xfournet

@xfournet xfournet commented Jun 29, 2026

Copy link
Copy Markdown

Fix #806

Summary by CodeRabbit

  • Bug Fixes
    • Improved debug logging behavior so it safely handles environments where process is unavailable.
    • Logging now consistently falls back to a no-op when debug mode is not enabled, reducing unnecessary output.

@coderabbitai

coderabbitai Bot commented Jun 29, 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

Run ID: afa2d8bb-1d52-4953-8243-b17b4796688e

📥 Commits

Reviewing files that changed from the base of the PR and between a0b6e21 and 9fb6114.

📒 Files selected for processing (1)
  • lib/utils/log.ts

📝 Walkthrough

Walkthrough

lib/utils/log.ts replaces the exported debug-logging function with a precomputed constant. The constant is assigned at module load time: console.log.bind(console) when process exists and DRAGGABLE_DEBUG is set, otherwise a no-op function.

Changes

Debug Logger

Layer / File(s) Summary
Precomputed logger constant
lib/utils/log.ts
Default export changed from a function that checks process.env.DRAGGABLE_DEBUG on each call to a constant computed once at module load, using console.log.bind(console) or a no-op.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A bunny once checked on each hop,
"Should I log? Should I stop?"
Now she binds at the start,
No mid-run change of heart —
One leap, and the logging won't stop! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the change: guarding against process being undefined in browser environments.
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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

lib/utils/log.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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.

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.

process.env.DRAGGABLE_DEBUG referenced in browser bundle (v4.6.0)

1 participant