-
Notifications
You must be signed in to change notification settings - Fork 380
Commit 25bc5ea
Migrate to react on rails auto-registration (#649)
This PR migrates the application from React on Rails v14 manual component registration to v16's auto-registration feature, eliminating the need to manually register each React component.
Key improvements:
- Components now auto-register via ror_components directory convention
- Removed manual component registration from client-bundle.js
- Simplified pack structure by eliminating client-bundle and server-bundle
- CI workflows updated to generate React on Rails packs before tests
- Layouts updated to use append_javascript_pack_tag for proper loading order
Breaking changes:
- Components must be placed in ror_components subdirectories
- client-bundle.js and server-bundle.js no longer exist
- Pack tags in layouts follow new append/final pattern
- Generated pack files added to gitignore
Technical details:
- Moved 5 components to ror_components directories (App, Footer, NavigationBarApp, RouterApp, SimpleCommentScreen)
- Added stores-registration.js for Redux store management
- Updated serverRegistration.jsx to use auto-registration API
- Fixed import paths for React on Rails v16 compatibility
- Resolved Shakapacker pack tag ordering requirements
Impact on existing installations:
- Existing apps need to restructure components into ror_components directories
- Layout files require updating to new pack tag pattern
- CI/CD pipelines need pack generation step before asset compilation
Impact on new installations:
- Simpler component registration process
- Less boilerplate code required
- Cleaner pack structure with auto-generated files
Security implications:
- No security issues introduced
- Server bundles remain properly isolated
Known issues:
- Minor Turbo warning about script loading location (cosmetic, documented in TODO_TURBO_WARNING.md)
This migration sets the foundation for React on Rails v16's improved developer experience while maintaining full compatibility with existing functionality.1 parent 5385b64 commit 25bc5ea
File tree
22 files changed
+219
-101
lines changed- .github/workflows
- app/views/layouts
- client/app
- bundles/comments
- components
- SimpleCommentScreen/ror_components
- rescript/RescriptShow/ror_components
- startup
- App/ror_components
- RouterApp/ror_components
- packs
- config
- initializers
22 files changed
+219
-101
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
47 | + | ||
48 | + | ||
49 | + | ||
47 | 50 |
| |
48 | 51 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 | + | ||
47 | + | ||
48 | + | ||
46 | 49 |
| |
47 | 50 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
73 | 73 |
| |
74 | 74 |
| |
75 | 75 |
| |
76 | + | ||
77 | + | ||
78 | + | ||
76 | 79 |
| |
77 | 80 |
| |
78 | 81 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 | - | ||
61 | - | ||
60 | + | ||
61 | + | ||
62 | + | ||
63 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
5 | - | ||
5 | + | ||
6 | 6 |
| |
7 | 7 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 | - | ||
9 | - | ||
10 | - | ||
11 | - | ||
12 | - | ||
13 | - | ||
14 | - | ||
8 | + | ||
9 | + | ||
10 | + | ||
15 | 11 |
| |
16 | 12 |
| |
17 | 13 |
| |
| |||
24 | 20 |
| |
25 | 21 |
| |
26 | 22 |
| |
23 | + | ||
24 | + | ||
25 | + | ||
27 | 26 |
| |
28 | 27 |
| |
29 | 28 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 | - | ||
9 | - | ||
10 | - | ||
11 | - | ||
12 | - | ||
13 | - | ||
14 | - | ||
8 | + | ||
9 | + | ||
15 | 10 |
| |
16 | 11 |
| |
17 | 12 |
| |
| |||
23 | 18 |
| |
24 | 19 |
| |
25 | 20 |
| |
21 | + | ||
22 | + | ||
23 | + | ||
26 | 24 |
| |
27 | 25 |
| |
26 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 | - | ||
14 | - | ||
15 | - | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
|
0 commit comments