-
-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Labels
nextjsRegarding the NextJS packageRegarding the NextJS package
Description
Problem
Currently, when a page is published in the Chai Builder, the system calls the Next.js revalidation API (/api/revalidate) which invalidates the cache using revalidatePath() and revalidateTag(). However, this only marks the cache as stale—it doesn't actually regenerate the page.
To ensure the page is immediately generated and ready to serve (ISR/SSG), we should trigger a GET request to each published page's slug after the revalidation completes. This will force Next.js to regenerate the static page on the server.
Current Flow
- User publishes page(s) via publish button/modal
PublishChangesActionexecutes (backend)- Pages are copied to
appPagesOnlinetable - Revalidation webhook is called →
/api/revalidateendpoint revalidatePath()/revalidateTag()invalidates cache- ❌ Page is NOT generated until first user visit
Desired Flow
- User publishes page(s)
PublishChangesActionexecutes- Pages copied to
appPagesOnline - Revalidation webhook called
- Cache invalidated
- ✅ For each published page with a slug, trigger
GET /<slug>to force generation
Acceptance Criteria
- After publishing page(s), the Next.js app triggers GET requests to all affected slugs
- GET requests are made AFTER cache invalidation completes
- Only pages with valid slugs are requested (skip "THEME" or pages without slugs)
- Errors in page generation don't block the publish flow (fail gracefully)
- Works across all publish entry points (topbar, modal, theme publish)
Reactions are currently unavailable
Metadata
Metadata
Labels
nextjsRegarding the NextJS packageRegarding the NextJS package