Skip to content

Conversation

@justin808
Copy link
Member

@justin808 justin808 commented Nov 11, 2025

Summary

Added changelog entries for two recent user-visible changes:

These entries document improvements to error messaging and a critical bug fix for component registration timing.

🤖 Generated with Claude Code


This change is Reviewable

Summary by CodeRabbit

  • Bug Fixes

    • Resolved intermittent component registration failures by optimizing the default loading strategy, ensuring all registrations complete before hydration to prevent "Component not registered" errors.
  • Documentation

    • Refined error messaging for configuration validation, improving clarity on available configuration options.

Added entries for:
- PR #1976: Polished error messages in configuration validation
- PR #1972: Fixed component registration race condition with defer loading

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

Walkthrough

This PR addresses a component registration race condition by changing the default component packs loading strategy from :sync to :defer. The CHANGELOG is updated to document this bug fix and polished error messages to highlight :defer as the preferred option.

Changes

Cohort / File(s) Summary
Documentation Updates
CHANGELOG.md
Added bug fix entry for component registration race condition and polished configuration validation error messages to prefer :defer over :sync

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • CHANGELOG.md is a documentation file with straightforward entries about a configuration default change and error message improvement; no logic review needed.

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • alexeyr-ci2
  • AbanoubGhadban

Poem

🐇 Sync would race, oh what a sight,
Defer came along to make things right,
Components register, hydration flows true,
No more race conditions—hooray, we're through! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and accurately reflects the main change: updating the CHANGELOG for two specific PRs (#1976 and #1972).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch justin808/barcelona-v1

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 and usage tips.

@claude
Copy link

claude bot commented Nov 11, 2025

Code Review

Summary

This PR adds CHANGELOG entries for two recent PRs (#1976 and #1972). The changes document a bug fix and an improvement to error messages.

✅ Positive Aspects

  1. Correct Formatting: PR references follow the project standard without hash symbols ([PR 1976] not [PR Polish configuration error message and add test comment #1976]), as specified in CLAUDE.md
  2. Appropriate Categorization:
    • Bug fix correctly placed under "Bug Fixes" section
    • Enhancement correctly placed under "Added" section (near other error message improvements)
  3. Clear Descriptions: Both entries provide meaningful context about what changed and why
  4. Proper Attribution: Includes correct PR links and author attribution
  5. User-Visible Changes: Both entries document user-visible improvements (error messages and bug fixes), which is appropriate per CLAUDE.md guidelines

📝 Observations

  1. Inconsistency in Existing CHANGELOG: While this PR follows the correct format (no hash), there are many existing entries with # in PR references (e.g., [PR Don't include 'react-dom/server' in the RSC bundle #1888], [PR Update preinstall script to enable use as a Git dependency #1873]). This isn't an issue with this PR, but the project may want to standardize these in a future cleanup.

  2. Entry Length: The bug fix entry is quite detailed (3 sentences). While this is helpful, compare it to other entries:

    • Some are concise: "Fixed bug in resolving..."
    • Others are detailed like this one

    The current level of detail is appropriate given the critical nature of the race condition fix.

  3. Section Placement: The "Polished Error Messages" entry appears after "Improved RSC Payload Error Handling" in the "Added" section. This is chronologically reverse (PR 1976 comes after PR 1888), but matches the existing pattern where newer entries appear at the top of each section.

🎯 Recommendations

No changes required. This PR correctly follows all CHANGELOG conventions:

  • ✅ Documents user-visible changes only
  • ✅ Uses correct PR reference format (no hash)
  • ✅ Includes proper attribution
  • ✅ Provides clear, helpful descriptions
  • ✅ Follows existing style and structure

🚀 Approval

This PR is ready to merge. The CHANGELOG entries accurately document the referenced changes and follow all project conventions.


Review generated by Claude Code

@coderabbitai coderabbitai bot added the bug label Nov 11, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
CHANGELOG.md (1)

38-38: Minor formatting inconsistency in PR references.

Lines 38 and 56 use [PR 1976] and [PR 1972] without the # prefix, while other recent entries in the Unreleased section use [PR #1881], [PR #1852], etc. with the # prefix. Standardize the PR reference formatting for consistency.

- - **Polished Error Messages**: Improved configuration error message wording for loading strategy validation. Error messages now show the preferred `:defer` option first, followed by `:sync`. [PR 1976](https://github.com/shakacode/react_on_rails/pull/1976) by [justin808](https://github.com/justin808).
+ - **Polished Error Messages**: Improved configuration error message wording for loading strategy validation. Error messages now show the preferred `:defer` option first, followed by `:sync`. [PR #1976](https://github.com/shakacode/react_on_rails/pull/1976) by [justin808](https://github.com/justin808).

- - **Component Registration Race Condition**: Fixed intermittent component registration errors caused by a race condition with defer script loading. Changed default loading strategy from `:sync` to `:defer` to ensure deterministic script execution order. This ensures component registrations complete before React hydration starts, preventing "Component not registered" errors in CI and production. [PR 1972](https://github.com/shakacode/react_on_rails/pull/1972) by [justin808](https://github.com/justin808).
+ - **Component Registration Race Condition**: Fixed intermittent component registration errors caused by a race condition with defer script loading. Changed default loading strategy from `:sync` to `:defer` to ensure deterministic script execution order. This ensures component registrations complete before React hydration starts, preventing "Component not registered" errors in CI and production. [PR #1972](https://github.com/shakacode/react_on_rails/pull/1972) by [justin808](https://github.com/justin808).

Also applies to: 56-56

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93c15ef and 17f74e7.

📒 Files selected for processing (1)
  • CHANGELOG.md (2 hunks)
🧰 Additional context used
🧠 Learnings (8)
📚 Learning: 2024-12-12T13:07:09.929Z
Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/ReactOnRailsRSC.ts:87-87
Timestamp: 2024-12-12T13:07:09.929Z
Learning: When handling errors in 'node_package/src/ReactOnRailsRSC.ts', include the error stack in error messages in development and test environments to aid debugging.

Applied to files:

  • CHANGELOG.md
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
1. Pro version check in `run_stream_inside_fiber`
2. RSC support check during pack generation via `ReactOnRailsPro.configuration.enable_rsc_support`
3. RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.

Applied to files:

  • CHANGELOG.md
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.

Applied to files:

  • CHANGELOG.md
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.

Applied to files:

  • CHANGELOG.md
📚 Learning: 2025-09-15T21:24:48.207Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1781
File: node_package/src/ClientSideRenderer.ts:82-95
Timestamp: 2025-09-15T21:24:48.207Z
Learning: In React on Rails, the force_load feature includes both explicit `data-force-load="true"` usage and the ability to hydrate components during the page loading state (`document.readyState === 'loading'`). Both capabilities require a Pro license, so the condition `!railsContext.rorPro && (isComponentForceLoaded || document.readyState === 'loading')` correctly gates both scenarios.

Applied to files:

  • CHANGELOG.md
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.

Applied to files:

  • CHANGELOG.md
📚 Learning: 2025-10-23T17:22:01.074Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. The `react_on_rails_pro?` method validates licenses and should raise errors early (including during path resolution in methods like `server_bundle?`) to enforce licensing requirements rather than failing later with obscure errors.

Applied to files:

  • CHANGELOG.md
📚 Learning: 2025-02-13T16:50:26.861Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/turbolinksUtils.ts:34-36
Timestamp: 2025-02-13T16:50:26.861Z
Learning: In React on Rails, when checking for Turbolinks version 5 using `turbolinksVersion5()`, always ensure `Turbolinks` exists first by checking `turbolinksInstalled()` to prevent TypeError when accessing properties.

Applied to files:

  • CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: markdown-link-check
  • GitHub Check: claude-review
🔇 Additional comments (1)
CHANGELOG.md (1)

56-56: Verify default loading strategy change is intentional and sufficiently highlighted.

The component registration race condition fix changes the default loading strategy from :sync to :defer. While this appears to be a necessary fix with clear justification (ensuring deterministic script execution before hydration), consider whether this warrants explicit mention in the "Breaking Changes" section or a migration guide, particularly if users rely on the old :sync default behavior in their applications.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants