Commit ad2a54c
authored
Engine: Avoid applying debug spans inside
This pull request fixes #952.
`javascript_tag` blocks were still receiving debug spans when debug mode
was enabled, even though raw `<script>` tags were already excluded. This
caused JavaScript code inside the helper to break.
To address this, I introduced an `@erb_block_stack` to track the current
ERB block and extended `in_excluded_context?` to detect `javascript_tag`
calls within ERB. When inside such a block, debug spans are skipped.
A snapshot test has been added to ensure that ERB expressions inside
`javascript_tag` do not receive debug spans.
If you have any feedback on the approach or implementation, I’d be happy
to adjust!javascript_tag blocks (#953)1 parent a43c7e6 commit ad2a54c
File tree
4 files changed
+49
-1
lines changed- lib/herb/engine
- sig/herb/engine
- test
- engine
- snapshots/engine/debug_mode_test
4 files changed
+49
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
| |||
295 | 302 | | |
296 | 303 | | |
297 | 304 | | |
298 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
299 | 310 | | |
300 | 311 | | |
301 | 312 | | |
| |||
332 | 343 | | |
333 | 344 | | |
334 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
335 | 358 | | |
336 | 359 | | |
337 | 360 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
394 | 405 | | |
395 | 406 | | |
Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments