fix(rpubs): fix shadow root double-attach and PDF generate route

- 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 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-20 22:14:16 -07:00
parent c23d7eb65b
commit d39c24c61b
1 changed files with 2 additions and 2 deletions

View File

@ -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({