From d39c24c61b73c23eecde63ad5bcc7f5195c47b01 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Fri, 20 Mar 2026 22:14:16 -0700 Subject: [PATCH] fix(rpubs): fix shadow root double-attach and PDF generate route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Guard attachShadow with existing check to prevent crash on reconnect - Fix API path: /pubs/api/generate → /rpubs/api/generate (module ID is rpubs) - The "Unexpected non-whitespace character" error was HTML 404 parsed as JSON Co-Authored-By: Claude Opus 4.6 --- modules/rpubs/components/folk-pubs-editor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/rpubs/components/folk-pubs-editor.ts b/modules/rpubs/components/folk-pubs-editor.ts index 81e0b58..8d5a354 100644 --- a/modules/rpubs/components/folk-pubs-editor.ts +++ b/modules/rpubs/components/folk-pubs-editor.ts @@ -98,7 +98,7 @@ export class FolkPubsEditor extends HTMLElement { } async connectedCallback() { - this.attachShadow({ mode: "open" }); + if (!this.shadowRoot) this.attachShadow({ mode: "open" }); this._tour = new TourEngine( this.shadowRoot!, FolkPubsEditor.TOUR_STEPS, @@ -598,7 +598,7 @@ export class FolkPubsEditor extends HTMLElement { this.render(); try { - const res = await fetch(`/${this._spaceSlug}/pubs/api/generate`, { + const res = await fetch(`/${this._spaceSlug}/rpubs/api/generate`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({