btst-plugin-ssg
Installation
SKILL.md
BTST Plugin SSG Support
Why route.loader() fails at build time
route.loader() makes HTTP requests. No server exists during next build, so fetches fail silently — static pages render empty. Solution: expose prefetchForRoute on the raw factory to seed React Query directly from the DB.
Required files per plugin
| File | Purpose |
|---|---|
api/query-key-defs.ts |
Shared key shapes — import into both query-keys.ts and prefetchForRoute |
api/serializers.ts |
Convert Date fields → ISO strings before setQueryData |
api/getters.ts |
Add any ID-based getters prefetchForRoute needs |
api/plugin.ts |
RouteKey type + typed overloads + wire prefetchForRoute into raw factory |
api/index.ts |
Re-export RouteKey, serializers, PLUGIN_QUERY_KEYS |
query-keys.ts |
Import discriminator fn from api/query-key-defs.ts |
client/plugin.tsx |
isConnectionError warn in each loader catch block |