Problem
Public sheet links (/p/{slug}) display a static "Loading spreadsheet..." placeholder instead of the interactive spreadsheet viewer.
Root Cause
The Cloudflare Worker SSR intercepts all /p/* routes and returns server-rendered HTML for SEO. This works for notes/diagrams/code because the content is static HTML.
However, sheets require:
- The React SPA to load
PublicSheetsViewer component to hydrate
- Univer.js to render the spreadsheet
The SSR HTML doesn't include the React app bundle (<script type="module" src="/assets/index-*.js">), so the page never hydrates and the spreadsheet never renders.
Solution
For sheets, bypass SSR and pass the request through to the SPA origin:
if (note.type === 'sheets') {
return fetch(request);
}
Trade-off
Sheets won't have SSR for crawlers/SEO. If SEO for sheets is needed later, we could:
- Fetch the origin's index.html and inject it into SSR response
- Generate a preview image/table of the sheet data for SSR