Skip to content

Follow-up: RSC client-references generator maintainability nits from PR #3219 #3434

@justin808

Description

@justin808

Deferred review feedback from PR #3219

These are two maintainability nits raised by the claude[bot] review run on PR #3219 that are documented in the relevant methods but worth cleaning up in a focused follow-up.

Discuss items

  • react_on_rails/lib/generators/react_on_rails/rsc_setup/client_references.rb:134rsc_client_references_rewrite_needed? predicate has side effects (@claude[bot], fix: scope RSC client reference discovery #3219 (comment))
    The _needed? suffix advertises a pure predicate, but the method calls ensure_rsc_client_references_setup, which can write the scoped helper to disk. The behavior is documented in the method's opening comment, but a future maintainer scanning method names alone could miss it. Likely fix: split into an explicit prepare_rsc_client_references_setup step and a pure rsc_plugin_needs_client_references_rewrite? predicate, then update the single internal call site in update_existing_rsc_webpack_config.

  • react_on_rails/lib/generators/react_on_rails/rsc_setup/client_references.rb:152rsc_plugin_sections_safe_to_rewrite? is_server: kwarg is misleading (@claude[bot], fix: scope RSC client reference discovery #3219 (comment))
    The kwarg is forwarded to rsc_plugin_option_sections_partition, but the :unparseable count the safety predicate gates on is computed across all RSCWebpackPlugin invocations regardless of is_server. So is_server: true and is_server: false produce the same safety verdict on the same file. Either drop the kwarg and call partition with one side, or add a one-line comment clarifying the cross-bundle scope.


Original PR: #3219

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions