Skip to content

Fix multi-site support#115

Merged
jasonvarga merged 5 commits intomasterfrom
fix-multisite
Apr 24, 2026
Merged

Fix multi-site support#115
jasonvarga merged 5 commits intomasterfrom
fix-multisite

Conversation

@jasonvarga
Copy link
Copy Markdown
Member

@jasonvarga jasonvarga commented Apr 24, 2026

When a user switched sites (or between localizations) on an entry, the workspace kept broadcasting on the channel it joined at mount time. That leaked values from one site into another, and two users starting on different sites could never meet on the same channel.

The workspace now watches the container's reference and site and restarts the channel when either changes: leaves the old channel, tears down the value/meta/focus watchers, cancels pending debounced broadcasts, destroys the old status bar, clears stale field-focus locks, and re-runs channel-specific setup against the new channel. The subscribe-timeout closure captures its own handle so a late callback from the previous channel can't cancel the new one. Global Statamic hooks are registered only in the initial start() so they don't accumulate on each restart.

This depends on companion changes in statamic/cms that expose reference and site as refs on the publish container and ensure pushComponent(...) can be destroyed cleanly — those need to ship together.

Requires statamic/cms#14548
Fixes #90

🤖 Generated with Claude Code

jasonvarga and others added 5 commits April 24, 2026 14:21
The channel name is built from the container's reference and site, but
both were captured once at mount time. When a user switched sites (or
to a different localization) the workspace kept broadcasting on the
original channel, leaking values across sites.

The container now exposes reference and site as refs. The workspace
watches them and, on change, leaves the old channel, tears down the
value/meta/focus watchers, cancels pending debounced broadcasts,
destroys the old status bar, and re-runs channel-specific setup against
the new channel. Global hooks are registered once and no longer
re-registered on restart.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The multi-site fix depends on reactive reference/site refs and a
destroyable pushComponent — both landing in Statamic 6.15.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reference is now a ref on the publish container, so the guard needs to
read the unwrapped value.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Without this, remote users' field locks and our own focus entry would
linger in container.fieldFocus across a site switch, leaving stale
locks on fields that may not exist in the new localization.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Before, the subscribed/error closures read this.subscribeTimeout by
identity. After a restart, a late callback from the previous channel
could clear the new channel's timeout. Each closure now captures its
own handle and only clears that one.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jasonvarga jasonvarga merged commit fd1746d into master Apr 24, 2026
@jasonvarga jasonvarga deleted the fix-multisite branch April 24, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Does not work with Localizing Entries \ Multi-Site

1 participant