Skip to content

feat(rebuild): rebuild pages on pubish action#787

Merged
surajair merged 11 commits intodevfrom
revert-revalidate-pr
Mar 2, 2026
Merged

feat(rebuild): rebuild pages on pubish action#787
surajair merged 11 commits intodevfrom
revert-revalidate-pr

Conversation

@amitdhiman5086
Copy link
Copy Markdown
Contributor

@amitdhiman5086 amitdhiman5086 commented Feb 28, 2026

fix: #773
This pull request introduces a new Next.js-specific action handler for publishing changes, enhances the publishing logic to support both tags and paths for cache revalidation, and refactors the API route to use the new handler. Additionally, it includes a minor class name fix for HTML and a small logging improvement.

Next.js Integration and Action Handling:

  • Added a new NextJsPublishChangesAction in frameworks/nextjs/package/actions.ts that extends the base publishing action to support Next.js cache revalidation using both tags and paths, and introduced initChaiBuilderNextJSActionHandler to handle streaming and JSON responses in a Next.js-friendly way.

  • Updated the API route in frameworks/nextjs/app/(builder)/api/route.ts to use the new Next.js-specific action handler, simplifying the response logic and ensuring compatibility with streaming and cache revalidation. [1] [2]

Publishing Logic Enhancements:

  • Refactored PublishChangesAction in src/actions/builder/publish-changes.ts to return both tags and paths for published changes, and updated internal methods (publishTheme, publishDesignToken, publishPage) to support this dual return type for more granular cache invalidation. [1] [2] [3] [4] [5] [6]

  • Exported PublishChangesAction from the main actions entry point for broader accessibility.

UI and Logging Improvements:

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 28, 2026

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: sdk.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 28, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
sdk-nextjs f2320e3 Mar 02 2026, 11:52 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 28, 2026

Deploying sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: f2320e3
Status: ✅  Deploy successful!
Preview URL: https://148e1b1d.sdk-8n4.pages.dev
Branch Preview URL: https://revert-revalidate-pr.sdk-8n4.pages.dev

View logs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the publish-changes flow to support path-based revalidation in the Next.js framework integration, alongside a couple of small cleanup/UI tweaks.

Changes:

  • Extend PublishChangesAction to return both tags and paths so consumers can trigger more targeted cache/path revalidation.
  • Add a Next.js-specific publish action wrapper that revalidates returned tags/paths, and switch the builder API route to use this handler.
  • Minor tweaks: simplify publish error logging in the builder UI and adjust the public page HTML class name.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/pages/hooks/pages/mutations.ts Simplifies publish error logging output.
src/actions/export.ts Re-exports PublishChangesAction for external consumers (e.g., framework adapters).
src/actions/builder/publish-changes.ts Returns { tags, paths } from publish operations and collects both across ids.
frameworks/nextjs/package/actions.ts Adds Next.js wrapper action to revalidate by tag/path and provides a Next.js-specific action handler init.
frameworks/nextjs/app/(public)/[[...slug]]/page.tsx Updates the <html> class name for smooth scrolling styling.
frameworks/nextjs/app/(builder)/api/route.ts Routes builder POST handling through the new Next.js action handler initializer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frameworks/nextjs/package/actions.ts Outdated
Comment thread src/actions/builder/publish-changes.ts Outdated
@surajair surajair changed the title Revert revalidate pr feat(rebuild): rebuild pages on pubish action Mar 2, 2026
@surajair surajair added the qa Test the issue/PR label Mar 2, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 2, 2026

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

Project Deployment Actions Updated (UTC)
sdk Ready Ready Preview, Comment Mar 2, 2026 11:14am

Request Review

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like prettify is not ran here

@surajair surajair merged commit 5908beb into dev Mar 2, 2026
1 of 3 checks passed
@surajair surajair deleted the revert-revalidate-pr branch March 2, 2026 17:40
surajair added a commit that referenced this pull request Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qa Test the issue/PR ready-to-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trigger GET request to page slug after publish to generate page post-invalidation (Next.js)

3 participants