Skip to content

Commit e296e95

Browse files
ihabadhamclaude
andauthored
Fix Redux generator creating unnecessary CSS in ror_components directory (#1826)
Pass redux option to base generator to prevent it from creating HelloWorld/ror_components directory and CSS files when Redux is used. The base generator now correctly receives the redux option and skips creating non-Redux component structure when --redux flag is used. Fixes #1821 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Add test coverage for Redux generator directory isolation Add test to verify that Redux installations do not create the HelloWorld/ror_components directory that should only exist for non-Redux installations. This test prevents regression of issue #1821 where Redux generator was incorrectly creating CSS files in the wrong directory structure. The test runs in both JavaScript and TypeScript Redux contexts to ensure complete coverage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 58d7404 commit e296e95

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/generators/react_on_rails/install_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def invoke_generators
7373
create_css_module_types
7474
create_typescript_config
7575
end
76-
invoke "react_on_rails:base", [], { typescript: options.typescript? }
76+
invoke "react_on_rails:base", [], { typescript: options.typescript?, redux: options.redux? }
7777
if options.redux?
7878
invoke "react_on_rails:react_with_redux", [], { typescript: options.typescript? }
7979
else

spec/react_on_rails/support/shared_examples/react_with_redux_generator_examples.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@
2323
app/javascript/src/HelloWorldApp/ror_components/HelloWorldApp.client.jsx
2424
app/javascript/src/HelloWorldApp/ror_components/HelloWorldApp.server.jsx].each { |file| assert_file(file) }
2525
end
26+
27+
it "does not create non-Redux HelloWorld ror_components directory" do
28+
assert_no_directory "app/javascript/src/HelloWorld/ror_components"
29+
assert_no_file "app/javascript/src/HelloWorld/ror_components/HelloWorld.module.css"
30+
end
2631
end

0 commit comments

Comments
 (0)