Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/generators/reactionview/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create_initializer
# config.intercept_erb = true

# Enable debug mode in development (adds debug attributes to HTML)
config.debug_mode = Rails.env.development?
config.debug_mode = Rails.env.development? && ENV.fetch("REACTIONVIEW_DEBUG_MODE", "true") == "true"
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
config.debug_mode = Rails.env.development? && ENV.fetch("REACTIONVIEW_DEBUG_MODE", "true") == "true"
config.debug_mode = Rails.env.development? && !ENV["REACTIONVIEW_DISABLE_DEBUG_MODE"]

@t27duck Thanks for the feedback! You make a great point about the simplicity of checking for the presence of the environment variable rather than its specific value.

You're absolutely right that this is cleaner - any value ("1", "yes", "TRUE", etc.) would disable debug mode, which is more intuitive and follows common Unix conventions.

My initial implementation was more verbose because I like environment variables that explicitly say what they're doing (like REACTIONVIEW_DEBUG_MODE=false), but at the end of the day, this is really just a matter of taste and your approach is definitely more concise.

The important thing is that we're solving the core problem: allowing individual developers in a team to control debug mode through their personal environment setup without changing code that affects everyone else. Whether someone prefers REACTIONVIEW_DISABLE_DEBUG_MODE=1 or REACTIONVIEW_DEBUG_MODE=false is secondary to having that flexibility.

I'm open to updating the implementation either way 🙂

Copy link
Owner

Choose a reason for hiding this comment

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

FWIW, I think I also like "opt-out" DISABLE approach more, since it's more intuitive.

But also, I'm wondering why you would want to disable it? I get that now in the beginning there might be some bugs and that might be why you'd want to disable it. But ideally, I want as many people to use it so we are able to surface these bugs and can make it better for everyone 🙈

Copy link
Author

@elalemanyo elalemanyo Oct 1, 2025

Choose a reason for hiding this comment

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

@marcoroth I totally understand your point and I’m also in favor of having it enabled by default so more people use it and we can improve it step by step. 🙌
At the same time, I’ve run into some bugs that might not be so easy to fix quickly, which is why I thought having the option to disable it could be useful in certain cases 😬.

The reason I suggested the disable option is that I’ve run into some issues when using ViewComponent slots (renders_one / renders_many).

I’ve put together a small repo: ReactionView + Bootstrap.

shot2025-10-01 at 15 09 09@2x

One issue I noticed is that the extra HTML that ReactionView injects for the debug console can interfere with CSS selectors. For example, selectors like :first-child, :last-child or adjacent sibling selectors (.selector + .selector) no longer match as expected because the injected elements change the DOM structure. This can cause layouts or designs to break visually 😔.

Sure, it’s definitely something we can help fix (and we will 👍), but just in case, it would be nice to have a way to disable it locally for a moment — that way we can quickly confirm whether the issue comes from ReactionView or the app code itself.


# Add custom transform visitors to process templates before compilation
# config.transform_visitors = [
Expand Down