docs: clarify railsContext.rorPro semantics#2590
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughClarifies that Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
Greptile SummaryThis PR is a pure semantics/documentation clarification: Key changes:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Rails Server] -->|"react_on_rails_pro? (gem presence check)"| B{Pro gem installed?}
B -- Yes --> C["rorPro: true\n(installation signal only)"]
B -- No --> D["rorPro: false"]
C --> E[railsContext serialized to client]
D --> E
E --> F[Browser: ClientSideRenderer]
F --> G{isImmediateHydrationRequested\n&& !hasProInstalled?}
G -- Yes --> H[console.warn + fallback to standard hydration]
G -- No --> I[Normal hydration / rendering flow]
style C fill:#d4edda,stroke:#28a745
style D fill:#f8d7da,stroke:#dc3545
style H fill:#fff3cd,stroke:#ffc107
Last reviewed commit: 15978ab |
|
Overall this is a clean, well-scoped clarification. The rename of
Otherwise LGTM — no runtime behaviour is changed, and the semantics are now accurately documented across Ruby, TypeScript, and docs. |
size-limit report 📦
|
|
This is a clean, well-scoped documentation and naming clarification with no runtime behavior changes. Critical fix in utils.rb: the old comment block was self-contradictory — the first line said 'Checks if React on Rails Pro is installed and licensed' while the next two lines contradicted it. The new consolidated comment is accurate. The variable rename (hasProLicense to hasProInstalled) is semantically correct, and the TypeScript type comment clearly states both what the field means and what it does not mean. Changes are consistent across Ruby, TypeScript, and docs. Minor nit: the comment added in render-functions-and-railscontext.md uses terse phrasing ('Pro package installed (not license-valid state)') — something like 'True if the React on Rails Pro gem is installed (not a license-validity check)' would be slightly clearer for docs readers. Overall, worthwhile fix for a genuine semantic confusion. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@react_on_rails/lib/react_on_rails/utils.rb`:
- Around line 254-258: The predicate react_on_rails_pro? is now defined as an
install-only signal, so update any messaging and docstrings that treat it as a
license check: revise the warning method immediate_hydration_pro_license_warning
and the docs/comments for normalize_immediate_hydration to refer to "Pro gem
installed" or "Pro gem presence" rather than "valid license" or "license check",
and ensure the text emitted by immediate_hydration_pro_license_warning reflects
installation status (e.g., suggests installing/uninstalling the Pro gem) and not
license validity; keep the predicate implementation unchanged but make the
string literals and method comments consistent with the install-only meaning.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 74b9bec9-6e5b-4973-838c-5d6e28d8e520
📒 Files selected for processing (6)
docs/oss/core-concepts/render-functions-and-railscontext.mdpackages/react-on-rails-pro/src/ClientSideRenderer.tspackages/react-on-rails/src/types/index.tsreact_on_rails/lib/react_on_rails/helper.rbreact_on_rails/lib/react_on_rails/utils.rbreact_on_rails_pro/LICENSE_SETUP.md
ReviewOverall this is a clean, low-risk documentation/naming clarification. One issue will break CI and a few minor nits are worth addressing. Bug: test spec regex no longer matches the renamed warning message
But the renamed method in These strings do not match, so this spec will fail on CI. The fix is to update the matcher to: Minor: spec context labels are semantically stale The two describe blocks at lines 1014 and 1043 of Minor: comment placement in The new comment was inserted before the existing TODO, separating the TODO from the field it refers to. Suggest placing it after the TODO, or consolidating both into a single comment block. The rename itself and all docs/type updates look accurate and consistent. |
PR Review: docs: clarify railsContext.rorPro semanticsOverall Assessment: This is a well-scoped, low-risk documentation and naming clarification. The intent — distinguishing "Pro is installed" from "license is valid" — is correct and the changes are consistently applied across Ruby, TypeScript types, tests, and documentation. What's done well:
One inconsistency to address: No other issues found. |
|
Updated to align with package-install semantics (no license-validity wording). |
|
Updated the immediate_hydration warning text to describe Pro package installation requirements (instead of license-validity wording). |
ReviewThe intent of this PR is clear and the direction is correct. The test updates are thorough and consistent. A couple of things worth addressing: 1. Potentially confusing warning message in ClientSideRenderer.ts The updated warning says the 'immediate_hydration' feature requires the React on Rails Pro package to be installed. But this warning fires when railsContext.rorPro is false, meaning the server-side Ruby gem is not installed. The file emitting the warning is itself inside the react-on-rails-pro JS package, so the package clearly IS installed from the user's perspective. The Ruby-side warning in utils.rb correctly says 'gem'. The TS message should be aligned, e.g.: 'requires the React on Rails Pro gem to be installed on the server.' 2. Comment ordering in helper.rb The new comment is inserted between the rorVersion line and an existing TODO. The TODO is specifically about rorPro (replace boolean with version string in v13). Having the new explanatory comment sandwiched between them makes the TODO look like a continuation of the new comment. Moving the new comment after the TODO, or merging them, would read more naturally. 3. CHANGELOG This PR renames a public-facing Ruby method (immediate_hydration_pro_license_warning to immediate_hydration_pro_install_warning) and changes warning message strings that third-party code might match against. A brief entry under [Unreleased] > Changed would be helpful. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Overall: Clean, low-risk docs/naming clarification — no behavior change, all call sites updated, tests aligned. Three minor points: (1) URL inconsistency — Ruby warning uses www.shakacode.com/react-on-rails-pro/ while TypeScript uses shakacode.com/react-on-rails-pro (both touched in this PR, easy to align). (2) immediate_hydration_pro_install_warning is a module-level self. method so technically public — consider private_class_method since it is an internal helper. (3) No CHANGELOG entry — the renamed public Ruby method and updated user-visible warning text arguably merit a short Unreleased entry per project conventions. |
Review: docs: clarify railsContext.rorPro semanticsOverall: This is a clean, well-scoped documentation and semantic-clarity PR. The changes are low-risk (no behavioral changes, only comment/warning-text/local-variable updates), and the naming alignment across Ruby and TypeScript is a clear improvement. A few small observations: Backward-compatible alias (
|
| # Backward-compatible alias for callers using the prior method name. | ||
| def self.immediate_hydration_pro_license_warning(name, type = "Component") | ||
| immediate_hydration_pro_install_warning(name, type) | ||
| end |
There was a problem hiding this comment.
The alias is preserved for backward compatibility, but since immediate_hydration_pro_license_warning has no external callers in this codebase (only the alias definition and the new spec), consider adding a @deprecated YARD annotation so tooling and future contributors know this name is being phased out:
| end | |
| # Backward-compatible alias for callers using the prior method name. | |
| # @deprecated Use {immediate_hydration_pro_install_warning} instead. | |
| def self.immediate_hydration_pro_license_warning(name, type = "Component") | |
| immediate_hydration_pro_install_warning(name, type) | |
| end |
| expect(warning).to eq( | ||
| described_class.immediate_hydration_pro_install_warning("TestComponent", "Component") | ||
| ) | ||
| end |
There was a problem hiding this comment.
This tests return-value equality, which is correct. If you want stronger coverage that the alias actually delegates (rather than duplicating logic), you could do:
it "delegates to the installation warning method for backward compatibility" do
expect(described_class).to receive(:immediate_hydration_pro_install_warning)
.with("TestComponent", "Component").and_call_original
described_class.immediate_hydration_pro_license_warning("TestComponent", "Component")
endNot a blocking concern — the current test is sufficient for a simple one-liner alias.
…icense_warning The alias has no external callers — the old method name is only referenced by its own definition and the test for it. Removing the alias and its test reduces maintenance surface without any behavioral change. Co-Authored-By: Claude Opus 4.6 <[email protected]>
PR Review: docs: clarify railsContext.rorPro semanticsOverall this is a clean, well-scoped documentation/naming PR. The semantic distinction between "Pro gem installed" vs. "Pro license valid" is important and the changes accurately reflect it across Ruby, TypeScript, docs, and tests. One factual inaccuracy in CHANGELOG.md that needs correction (see inline comment): The changelog entry claims: "added a backward-compatible alias for the previous warning helper method name", but no alias was added. The method A quick grep confirms no external callers exist within this repo (neither OSS nor Pro), so there is no actual breakage here — but the CHANGELOG entry should be corrected to remove the alias claim to avoid confusion. Everything else looks good:
|
|
|
||
| #### Changed | ||
|
|
||
| - **Clarified Pro-installation signaling for immediate hydration warnings**: Updated Ruby/TypeScript warning text and related docs to state that `railsContext.rorPro` indicates Pro gem installation (not license validity), and added a backward-compatible alias for the previous warning helper method name. [PR 2590](https://github.com/shakacode/react_on_rails/pull/2590) by [justin808](https://github.com/justin808). |
There was a problem hiding this comment.
The claim "added a backward-compatible alias for the previous warning helper method name" does not match the code. The method immediate_hydration_pro_license_warning was renamed to immediate_hydration_pro_install_warning — no alias was introduced. There are no external callers within this repo so no breakage occurs, but the changelog entry should be corrected to avoid misleading readers.
| - **Clarified Pro-installation signaling for immediate hydration warnings**: Updated Ruby/TypeScript warning text and related docs to state that `railsContext.rorPro` indicates Pro gem installation (not license validity), and added a backward-compatible alias for the previous warning helper method name. [PR 2590](https://github.com/shakacode/react_on_rails/pull/2590) by [justin808](https://github.com/justin808). | |
| - **Clarified Pro-installation signaling for immediate hydration warnings**: Updated Ruby/TypeScript warning text and related docs to state that `railsContext.rorPro` indicates Pro gem installation (not license validity), and renamed the Ruby warning helper from `immediate_hydration_pro_license_warning` to `immediate_hydration_pro_install_warning`. [PR 2590](https://github.com/shakacode/react_on_rails/pull/2590) by [justin808](https://github.com/justin808). |
The previous entry said a backward-compatible alias was added, but it was removed in the latest commit. Update to accurately describe the rename from immediate_hydration_pro_license_warning to immediate_hydration_pro_install_warning with no alias retained. Co-Authored-By: Claude Opus 4.6 <[email protected]>
| i18nLocale: string; | ||
| i18nDefaultLocale: string; | ||
| rorVersion: string; | ||
| // True when React on Rails Pro is installed on the server. |
There was a problem hiding this comment.
Minor wording nit: "Present when rorPro is true" implies the field is always defined when rorPro is true, but the field is typed as optional (rorProVersion?: string). A clearer phrasing might be:
| // True when React on Rails Pro is installed on the server. | |
| // Set when the React on Rails Pro gem is installed; contains the installed Pro version string. |
| @@ -29,8 +29,8 @@ import * as ComponentRegistry from './ComponentRegistry.ts'; | |||
|
|
|||
| const REACT_ON_RAILS_STORE_ATTRIBUTE = 'data-js-react-on-rails-store'; | |||
There was a problem hiding this comment.
Minor inconsistency: the Ruby-side warning (in utils.rb) says "requires the React on Rails Pro gem to be installed" without "on the server". Since this is client-side code the extra qualifier is useful, but it's worth keeping the two messages aligned so both surfaces give developers the same signal. Not blocking.
PR Review: railsContext.rorPro semantics clarificationClean, low-risk PR. Changes are internally consistent and semantically correct. A few minor observations (two posted as inline comments). No issues found:
Minor observations:
Overall: LGTM with the above as optional polish. |
Summary
railsContext.rorProsignals Pro installation, not license validityClientSideRendererfromhasProLicensetohasProGemInstalledfor semantic accuracyFixes #2453
Test Plan
bundle exec rubocop react_on_rails/lib/react_on_rails/utils.rb react_on_rails/lib/react_on_rails/helper.rbpnpm run eslint packages/react-on-rails-pro/src/ClientSideRenderer.ts packages/react-on-rails/src/types/index.tsNote
Low Risk
Low risk documentation/comment and naming clarification; runtime behavior is unchanged aside from a local variable rename used in immediate hydration gating.
Overview
Clarifies across OSS docs, Pro licensing docs, Ruby
rails_contextconstruction, and the TSRailsContexttype thatrailsContext.rorProis only a signal that the Pro gem/package is installed, not that a license token is valid.Renames the client-side immediate hydration gating variable in
ClientSideRendererfromhasProLicensetohasProGemInstalled(with an explanatory comment) to match the updated semantics.Written by Cursor Bugbot for commit 15978ab. Configure here.
Summary by CodeRabbit