Commit fd25322
Refactor immediate_hydration logic into shared utility method
Address code review feedback:
1. Consolidate duplicated immediate_hydration logic
- Create ReactOnRails::Utils.normalize_immediate_hydration method
- Replace inline logic in controller, helper, and render_options
- Reduces code duplication from 3 locations to 1 shared method
2. Document the == true check rationale
- Added comprehensive YARD documentation
- Explains strict equality is intentional (not truthy check)
- Prevents false positives from strings like "yes"/"no"
- Type safety handled at call site by Ruby's type system
Benefits:
- Single source of truth for immediate_hydration normalization
- Easier to test and maintain
- Clear documentation of behavior
- Consistent warning messages across all entry points
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 2e54457 commit fd25322
File tree
4 files changed
+37
-27
lines changed- lib/react_on_rails
- react_component
4 files changed
+37
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 18 | + | |
25 | 19 | | |
26 | 20 | | |
27 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 161 | + | |
168 | 162 | | |
169 | 163 | | |
170 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
112 | 104 | | |
113 | 105 | | |
114 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
23 | 53 | | |
24 | 54 | | |
25 | 55 | | |
| |||
0 commit comments