Skip to content

Commit 6671ac4

Browse files
TerrorJackCodex
andcommitted
fix: fix missing initialSyncDepth logic
This patch declares initialSyncDepth (and ensure syncDepth is initialized) in the wasm inlined JS runner so nested sync callbacks start with the correct depth. Do the same in the standalone jsaddleScript used for workers, keeping both entry points aligned with upstream JSaddle changes. Fixes the runtime ReferenceError that broke TodoMVC after updating jsaddle to the latest upstream. Co-authored-by: Codex <codex@openai.com>
1 parent d1685e7 commit 6671ac4

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src-js/Language/Javascript/JSaddle/Wasm/JS.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jsaddleScript =
1414
BLC8.unlines
1515
[ JSaddle.Files.ghcjsHelpers,
1616
JSaddle.Files.initState,
17+
"var initialSyncDepth = 0;",
18+
"var syncDepth = 0;",
1719
"function runJSaddle(worker) {",
1820
" worker.addEventListener('message', e => {",
1921
" const d = e.data;",

src-wasm/Language/Javascript/JSaddle/Wasm/Internal.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ run entryPoint = do
4646
let s =
4747
BLC8.unlines $
4848
[ JSaddle.Files.initState,
49+
"var initialSyncDepth = 0;",
4950
"var syncDepth = 0;",
5051
"(async () => {",
5152
" while (true) {",

0 commit comments

Comments
 (0)