Skip to content

Comments

feat: improve ssg dx#56

Open
olliethedev wants to merge 7 commits intomainfrom
feat/ssg-dx
Open

feat: improve ssg dx#56
olliethedev wants to merge 7 commits intomainfrom
feat/ssg-dx

Conversation

@olliethedev
Copy link
Collaborator

@olliethedev olliethedev commented Feb 24, 2026

Note

Medium Risk
Touches multiple plugin APIs and React Query cache key/serialization behavior, so incorrect key shapes or data hydration could cause subtle SSR/SSG cache misses or runtime rendering issues, but changes are largely additive and documented/tested.

Overview
Adds first-class SSG support to core plugins by introducing api.*.prefetchForRoute(routeKey, queryClient, params?), letting Next.js pages seed the React Query cache directly from the DB at build time (avoiding route.loader() HTTP calls that fail during next build).

Implements this pattern across Blog, CMS, Form Builder, and Kanban: new shared api/query-key-defs.ts key builders (and updates query-keys.ts to import them), route-key types + typed overloads for prefetchForRoute, and serializers/ID getters where needed so setQueryData matches the hydrated HTTP shapes (including useInfiniteQuery { pages, pageParams } and Date → ISO string conversion). Client loaders now detect connection-refused errors via a new isConnectionError helper and emit an actionable warning.

Updates the Next.js example app with dedicated SSG pages (/pages/ssg-*), ISR revalidate usage, and backend hooks calling revalidatePath on mutations; also adds Playwright smoke coverage for SSG rendering/revalidation, bumps @btst/stack to 2.3.0, and updates @btst/yar to 1.2.0 alongside expanded documentation.

Written by Cursor Bugbot for commit df26c04. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
better-stack-docs Ready Ready Preview, Comment Feb 25, 2026 1:03am

Request Review

…dation

Move SSG example pages from /pages/{plugin} to /pages/ssg-{plugin} to avoid
ambiguity with the catch-all routes. Adds revalidatePath calls in blog/cms/
forms/kanban lifecycle hooks so the ISR cache is purged when content changes.
Introduces a global singleton for myStack in the Next.js example to share the
same in-memory adapter across module boundaries. Exports KANBAN_QUERY_KEYS
from the kanban api index. Updates E2E smoke tests to target the new routes.

Co-authored-by: Cursor <cursoragent@cursor.com>
olliethedev and others added 3 commits February 24, 2026 19:52
Each plugin's SSG section now includes an example showing how to call
revalidatePath() inside backend lifecycle hooks so the Next.js ISR cache
is purged whenever content changes (blog, kanban, cms, form-builder).

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant