Commit 0f8a81f
Fix double-wrapping of console replay script in node-renderer
**Root Cause:**
The streaming renderer in streamingUtils.ts calls `buildConsoleReplay()`
which wraps the console JavaScript in `<script id="consoleReplayLog">` tags.
Then the Ruby helper (`react_on_rails_pro_helper.rb:351` and
`helper.rb:398`) calls `wrap_console_script_with_nonce()` again, creating
nested script tags.
When Nokogiri parses the resulting HTML and calls `.text` on the outer
script element, it returns the inner `<script id="consoleReplayLog">` tag
as TEXT content, causing the test to fail.
**Solution:**
Changed streamingUtils.ts line 115 and line 20 to use `consoleReplay()`
instead of `buildConsoleReplay()`. The `consoleReplay()` function returns
ONLY the JavaScript code without wrapping, allowing the Ruby helper to
add the single `<script>` tag with proper CSP nonce support.
**Why previous attempt failed:**
CI uses caching and the prepare script only rebuilds if lib/ doesn't exist.
The previous fix didn't trigger a rebuild, so CI used cached (broken) code.
**Verified:**
- Code analysis confirms double-wrapping issue
- TypeScript compiles successfully
- Build completes without errors
- Change is minimal and targeted
**Test:** renderer_console_logging_spec.rb:13
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 6c461a1 commit 0f8a81f
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
0 commit comments