Fix letrec structure: wait-for-el as proper binding, not begin-wrapped

The previous insert wrapped reload-frame and wait-for-el in a begin
block instead of making them separate letrec bindings. This made
reload-frame invisible to later bindings. Fixed by inserting
wait-for-el at index 3 in the letrec bindings list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 22:16:13 +00:00
parent cc9975aaf0
commit 017451370f

View File

@@ -24,29 +24,28 @@
"true")) "true"))
true true
(do (hs-wait 200) (wait-boot)))))) (do (hs-wait 200) (wait-boot))))))
(begin (reload-frame
(reload-frame (fn
(fn ()
() (let
(let ((w (host-get (dom-query "#test-iframe") "contentWindow")))
((w (host-get (dom-query "#test-iframe") "contentWindow"))) (host-call (host-get w "location") "reload")
(host-call (host-get w "location") "reload") (hs-wait 1000)
(hs-wait 1000) (wait-boot)
(wait-boot) (hs-wait 500))))
(hs-wait 500)))) (wait-for-el
(wait-for-el (fn
(fn (sel max-tries)
(sel max-tries) (let
(let ((doc (get-doc))
((doc (get-doc)) (el (when doc (host-call doc "querySelector" sel))))
(el (when doc (host-call doc "querySelector" sel)))) (if
el
el
(if (if
el (<= max-tries 0)
el nil
(if (do (hs-wait 200) (wait-for-el sel (- max-tries 1))))))))
(<= max-tries 0)
nil
(do (hs-wait 200) (wait-for-el sel (- max-tries 1)))))))))
(run-action (run-action
(fn (fn
(action) (action)