also looking at this
fix(includes): preserve {{ }} in @include partials that define their own signals (#1758)
#1759
3 files
+76
-6
| @@ -69,7 +69,7 @@ | ||
| 69 | 69 | import type { StxOptions } from './types' |
| 70 | 70 | import path from 'node:path' |
| 71 | 71 | import { processConditionals } from './conditionals' |
| 72 | import { processExpressions } from './expressions' | |
| 72 | import { processExpressions, usesSignalsInScript } from './expressions' | |
| 73 | 73 | import { LRUCache } from './performance-utils' |
| 74 | 74 | import { createSafeFunction, isExpressionSafe, safeEvaluate, safeEvaluateObject } from './safe-evaluator' |
| 75 | 75 | import { transformStoreImports } from './store-imports' |
| @@ -1103,8 +1103,17 @@ catch (e) { | ||
| 1103 | 1103 | // Process conditionals |
| 1104 | 1104 | processedContent = processConditionals(processedContent, includeContext, includeFilePath) |
| 1105 | 1105 | |
| 1106 | // Process expressions | |
| 1107 | processedContent = processExpressions(processedContent, includeContext, includeFilePath) | |
| 1106 | // Process expressions. | |
| 1107 | // The partial's <script> was stripped above (line ~925) so the style/script | |
| 1108 | // extractors and the parent's client-script pipeline don't double-process it. | |
| 1109 | // That also hides the partial's own state()/derived() from processExpressions' | |
| 1110 | // usesSignalsInScript gate, which would then evaluate `{{ signalCall() }}` | |
| 1111 | // server-side (undefined → emptied) and consume the marker, leaving nothing | |
| 1112 | // for the runtime to bind — the partial renders permanently blank. Recover the | |
| 1113 | // gate from the FULL partial content so a partial with a client signal script | |
| 1114 | // preserves {{ }} just like a top-level page. See stacksjs/stx#1758. | |
| 1115 | const partialHasSignals = usesSignalsInScript(partialContent) | |
| 1116 | processedContent = processExpressions(processedContent, includeContext, includeFilePath, { forceSignals: partialHasSignals }) | |
| 1108 | 1117 | |
| 1109 | 1118 | // Append preserved style and script for SFC support |
| 1110 | 1119 | if (preservedStyle) { |