You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ability to suppress console.warn messages about registered components
that are not used on a page. This is useful in production environments
where many React components are registered globally but only a subset
are used on each page.
Configuration:
config.suppress_unused_component_warnings = true
Changes:
- Add suppress_unused_component_warnings config option (default: false)
- Pass option to railsContext as suppressUnusedComponentWarnings
- Update CallbackRegistry to check the option before logging warnings
- Update TypeScript types and RBS signatures
- Update documentation and tests
Closes#2117
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ Changes since the last non-beta release.
25
25
26
26
#### Added
27
27
28
+
-**Suppress Unused Component Warnings**: Added `suppress_unused_component_warnings` configuration option to disable console warnings about registered components that are not used on a page. This is useful for production environments where many components are registered globally but only a subset are used on each page. Set `config.suppress_unused_component_warnings = true` in your React on Rails initializer. Note: This only affects React on Rails Pro users. [PR 2125](https://github.com/shakacode/react_on_rails/pull/2125) by [justin808](https://github.com/justin808).
29
+
28
30
-**Service Dependency Checking for bin/dev**: Added optional `.dev-services.yml` configuration to validate required external services (Redis, PostgreSQL, Elasticsearch, etc.) are running before `bin/dev` starts the development server. Provides clear error messages with start commands and install hints when services are missing. Zero impact if not configured - backwards compatible with all existing installations. [PR 2098](https://github.com/shakacode/react_on_rails/pull/2098) by [justin808](https://github.com/justin808).
Set to `0` to wait indefinitely (not recommended for production).
712
712
713
+
#### suppress_unused_component_warnings
714
+
715
+
**Type:** Boolean
716
+
**Default:** `false`
717
+
718
+
Suppress console warnings about registered components that are not used on a page:
719
+
720
+
```ruby
721
+
config.suppress_unused_component_warnings = true
722
+
```
723
+
724
+
When many React components are registered globally but only a subset are used on each page, React on Rails Pro will emit console warnings suggesting the unused components may be cleaned up. Set this option to `true` to suppress these warnings, which is useful in production environments where such warnings can be noisy.
725
+
726
+
> **Note:** This configuration option only affects React on Rails Pro users, as the warnings are generated by the Pro package's component registry timeout feature.
727
+
713
728
### I18n Configuration
714
729
715
730
These options are for applications using [react-intl](https://formatjs.io/docs/react-intl/) or similar internationalization libraries. If your application doesn't need i18n, you can skip this section.
0 commit comments