Skip to content

Commit 838cb19

Browse files
justin808claude
andcommitted
fix: Address code review feedback and fix CI issues
- Fix critical performance.now() fallback bug (was property instead of method) - Fix component size calculation (use "chars" instead of misleading "kb") - Add CHANGELOG entry for smart error messages feature - Fix test to enable Rainbow coloring for ANSI escape sequence assertion - Verify all files end with newline character 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c956985 commit 838cb19

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Changes since the last non-beta release.
3131

3232
- **Improved Error Messages**: Error messages for version mismatches and package configuration issues now include package-manager-specific installation commands (npm, yarn, pnpm, bun). [PR #1881](https://github.com/shakacode/react_on_rails/pull/1881) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
3333

34+
- **Smart Error Messages with Actionable Solutions**: Added intelligent Ruby-side error handling with context-aware, actionable solutions for common issues. Features include fuzzy matching for component name typos, environment-specific debugging suggestions, color-coded error formatting, and detailed troubleshooting guides for component registration, auto-bundling, hydration mismatches, server rendering errors, and Redux store issues. See the [Improved Error Messages guide](docs/guides/improved-error-messages.md) for details. [PR 1934](https://github.com/shakacode/react_on_rails/pull/1934) by [justin808](https://github.com/justin808).
35+
3436
- **Improved RSC Payload Error Handling**: Errors that happen during generation of RSC payload are transferred properly to rails side and logs the error message and stack. [PR #1888](https://github.com/shakacode/react_on_rails/pull/1888) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
3537

3638
#### Changed

packages/react-on-rails/src/base/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Fix: Use only react-on-rails OR react-on-rails-pro, not both.`);
186186
register(components: Record<string, ReactComponentOrRenderFunction>): void {
187187
if (this.options.debugMode || this.options.logComponentRegistration) {
188188
// Use performance.now() if available, otherwise fallback to Date.now()
189-
const perf = typeof performance !== 'undefined' ? performance : { now: Date.now };
189+
const perf = typeof performance !== 'undefined' ? performance : { now: () => Date.now() };
190190
const startTime = perf.now();
191191
const componentNames = Object.keys(components);
192192
console.log(
@@ -205,7 +205,7 @@ Fix: Use only react-on-rails OR react-on-rails-pro, not both.`);
205205
componentNames.forEach((name) => {
206206
const component = components[name];
207207
const size = component.toString().length;
208-
console.log(`[ReactOnRails] ✅ Registered: ${name} (~${(size / 1024).toFixed(1)}kb)`);
208+
console.log(`[ReactOnRails] ✅ Registered: ${name} (~${(size / 1024).toFixed(1)} chars)`);
209209
});
210210
}
211211
} else {

spec/react_on_rails/smart_error_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,13 @@ module ReactOnRails
151151
end
152152

153153
it "includes colored output markers" do
154+
# Enable Rainbow coloring for this test
155+
Rainbow.enabled = true
154156
message = error.message
155157
# Rainbow adds ANSI color codes
156158
expect(message).to match(/\e\[/) # ANSI escape sequence
159+
ensure
160+
Rainbow.enabled = false
157161
end
158162
end
159163

0 commit comments

Comments
 (0)