web: re-boost swapped content from the [sx-boost] ancestor (fixes back-then-click full reload)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 33s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 33s
After a fragment swap, process-elements(target) -> process-boosted(target) only boosted [sx-boost] containers that are DESCENDANTS of the swap target. But the swap target (#content) is nested UNDER the boost wrapper (<div sx-boost="#content"> <div id="content">), so re-boosting scoped to the target found nothing — the swapped-in links never got bound. Only the initial document-wide boot boost worked, so: home->sub worked (home links boosted at boot), but Back restored the home content unboosted, and the next click did a full page reload. (Post-page links were unboosted too; Back just exposed it.) process-boosted now ALSO boosts from the nearest [sx-boost] ANCESTOR of root (dom-closest), so any swap target inside a boost scope gets its links rebound. is-processed? guards keep it idempotent. spa-check: the back-button test now clicks AGAIN after Back and asserts it's a SPA nav (no full reload) — would have caught this. .sxbc regenerated. Verified: spa-check 4/4 (incl. click-after-back).
This commit is contained in:
@@ -714,9 +714,21 @@
|
||||
:effects (mutation io)
|
||||
(fn
|
||||
(root)
|
||||
(for-each
|
||||
(fn (container) (boost-descendants container))
|
||||
(dom-query-all (or root (dom-body)) "[sx-boost]"))))
|
||||
(do
|
||||
;; boost [sx-boost] containers WITHIN root (the document-scan case)
|
||||
(for-each
|
||||
(fn (container) (boost-descendants container))
|
||||
(dom-query-all (or root (dom-body)) "[sx-boost]"))
|
||||
;; ALSO boost from the nearest [sx-boost] ANCESTOR of root: a swap
|
||||
;; target (e.g. #content) is nested under <div sx-boost>, so re-boosting
|
||||
;; scoped to the target alone never finds the marker, leaving the
|
||||
;; swapped-in links dead (full reload on the next click). is-processed?
|
||||
;; guards keep this idempotent.
|
||||
(when
|
||||
root
|
||||
(let
|
||||
((anc (dom-closest root "[sx-boost]")))
|
||||
(when anc (boost-descendants anc)))))))
|
||||
(define
|
||||
boost-descendants
|
||||
:effects (mutation io)
|
||||
|
||||
Reference in New Issue
Block a user