Repository navigation
Description
Summary
On a Wix router page, Back/Forward to a URL the widget pushed makes Wix re-render the page and replace <sahaj-atlas> with a new element. The new element boots at the right route, but releaseOwnership() clears the query cache when a different element takes over, so every such press costs ~1.6 s, a full refetch and a new billed Mapbox map load. Keep the widget's state across a same-key replacement, and point hosts at SahajCloud's new Install tab.
Goal context
Part of #348 — the widget side: the map no longer reloads on Back/Forward on Wix, and the docs send volunteers to the setup screen.
Approach
src/Widget.tsx:503— inconnectedCallback, whenpendingTeardownis set and a different element arrives insideTEARDOWN_GRACE_MS(:476), it callsreleaseOwnership()(:481), which clearsqueryClientand the API key. When the API key is unchanged (the loader did not run again;embed.configis the same), transfer ownership instead: cancel the teardown, keep the query cache,owner = this. A different key keeps today's release — the reason that guard exists stands.- Keep the Mapbox map instance across the swap if the map's container can move into the new shadow root; otherwise accept a fresh map, with the data cache kept.
docs/embedding.md: a line at the top sending site owners to the Install tab in SahajCloud, and a Wix section — Custom Element only (tagsahaj-atlas, Server URLauto.js?key=…), never Embed HTML; SEO needs the Velo router the Install tab generates.CHANGELOG.md: the replacement behaviour, and the docs change.
Interfaces
- Consumes from sydevs/SahajCloud: the Install tab, which
embedding.mdlinks to. No API change.
Acceptance criteria
- Replacing
<sahaj-atlas>with a new element, same key, inside the grace window makes no new SahajCloud read and keeps the current route. - A replacement with a different key still releases and re-authenticates, as today.
-
embedding.mdopens with the pointer to the Install tab and has a Wix section.
Verification checklist
-
pnpm test:runfor the new jsdom spec covering same-key and different-key replacement. - On
https://sydevelopers.wixsite.com/atlas-spike-classic/about, inject the PR's previewauto.js, wait fordata-sahaj-atlas-ready, thenold.replaceWith(document.createElement('sahaj-atlas')): no request tocloud.sydevelopers.com/api/*follows, and content reappears. -
.claude/skills/pr-prep/check.shpasses.
Notes
Blocked by: sydevs/SahajCloud#1055 — the embedding.md pointer names the Install tab, which ships there; the widget change itself can be built alongside.
Measured with a simulated swap, not a real Custom Element (that needs a Premium site); confirmed at sahajayoga.ca's go-live.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
sydevs-bot commentedon Nov 10, 2026
#1055 closed, so nothing blocks this now. Say
@sydevs-bot implementto start it, or@sydevs-bot reviseto rework it first.🤖 sydevs dispatcher
Ardnived commentedon Nov 10, 2026
@sydevs-bot implement
sydevs-bot commentedon Nov 10, 2026
🤖 no session running
approved by Ardnived
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
Ardnived commentedon Nov 11, 2026
@sydevs-bot implement
sydevs-bot commentedon Nov 11, 2026
#383 is already open for this ticket, so I will not start a second implementation.
🤖 sydevs dispatcher
merge: bring main into feat-389-legible-brand-colours
fix(loader): auto.js runs as a classic script, so Wix can load it (#409)