Fix multi-site support#115
Merged
jasonvarga merged 5 commits intomasterfrom Apr 24, 2026
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
referenceandsiteand 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 initialstart()so they don't accumulate on each restart.This depends on companion changes in statamic/cms that expose
referenceandsiteas refs on the publish container and ensurepushComponent(...)can be destroyed cleanly — those need to ship together.Requires statamic/cms#14548
Fixes #90
🤖 Generated with Claude Code