From c5e3364311ffbad2432c042d33974ed42c21787a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Pl=C3=B6ns?= Date: Tue, 16 Jun 2026 12:56:49 +0200 Subject: [PATCH] Fix asset editors crashing when the container has no site Assets aren't site-scoped, so an asset publish container's `site.value` is undefined. initializeEcho() called `.replaceAll` on it unconditionally, throwing in the workspace init (a mounted hook) and preventing the asset editor from rendering its fields. Build the channel name without the site segment when no site is present (and use optional chaining), so asset editing works and assets still get a stable presence channel keyed by their reference. Fixes #126 --- resources/js/Workspace.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/js/Workspace.js b/resources/js/Workspace.js index 5b68e12..8a2ee89 100644 --- a/resources/js/Workspace.js +++ b/resources/js/Workspace.js @@ -102,7 +102,10 @@ export default class Workspace { initializeEcho() { const reference = this.container.reference.value.replaceAll('::', '.'); - this.channelName = `${reference}.${this.container.site.value.replaceAll('.', '_')}`; + // Assets aren't site-scoped, so their publish container has no site. + // Fall back to a site-less channel instead of throwing on `.replaceAll`. + const site = this.container.site?.value; + this.channelName = site ? `${reference}.${site.replaceAll('.', '_')}` : reference; const channelName = this.channelName; debug(`Joining channel "${channelName}"`);