Repository navigation
Conversation
…h and page.beforeCreateRevisionFrom Handlers for `page.beforePublish` received the page, but the publish only passed the page id on, so the CMS published the stored revision. Replacing a field on the page in a handler had no effect. `page.beforeCreateRevisionFrom` did not receive the page at all. `PublishPageUseCase` now publishes the page values the handlers left on the event, through a new optional `values` option on the CMS `PublishEntryUseCase`. The values go through the publish data factory, so they are validated like stored values. `page.beforeCreateRevisionFrom` now receives the source page, and the new revision is created with its values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…what handlers leave in input
`page.beforePublish` and `page.beforeCreateRevisionFrom` now carry
`{ original, input: { id, data } }`, like `page.beforeUpdate`. `original` is
the stored revision and `input.data` is what gets saved. `page.beforePublish`
keeps `page` as a deprecated alias of `original`, so existing handlers keep
working.
Create, update, publish and create-revision-from now save the input as it is
on the event after the handlers ran. A handler that replaces `input` or
`input.data` is no longer ignored. Before, only in-place edits reached the
write, because the use cases saved their own reference to the input.
The workflows `page.beforePublish` handler reads `original` instead of the
deprecated `page`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The payload is now `{ original, input: { id, data } }`, the same as `page.beforeUpdate`. `original` is the stored revision; `page` duplicated it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/vitest |
|
/e2e |
|
Vitest tests have been initiated (for more information, click here). ✨
|
|
E2E tests have been initiated (for more information, click here). ✨
|
…Manager events
Every page before-event now carries `page`, the record that gets saved,
next to `original` (the stored revision) and `input` (the request) where
those exist. This matches `EntryBefore*` (`entry`) and `FileBefore*`
(`file`).
- `page.beforeCreate`: `{ input, page }`
- `page.beforeUpdate`: `{ original, input, page }`, where `page` is
`original` with the update applied
- `page.beforePublish`: `{ original, page }`
- `page.beforeCreateRevisionFrom`: `{ params, original, page }`
`page` starts as a copy, so editing it never changes `original` or
`input`. Whatever `page` holds after the handlers run is what gets saved.
`IUpdateWbPageData` gains the optional `extensions` that create already
had.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…S events Each use case now saves the `page` object it put on the event, so handlers edit `page` in place. Assigning a new object to `event.payload.page` is not picked up. This matches CMS (`entry`) and File Manager (`file`) before-events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…before-events-persist Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What changed
Website Builder page "before" event handlers can now change the page that gets saved when a page is created, updated, published, or used to create a new revision. Before, changes made in
page.beforePublishwere dropped.page.beforeCreateRevisionFromgave handlers nothing to change. In create and update, replacing the input object was ignored.All four events now follow the same convention as CMS (
EntryBefore*→entry) and File Manager (FileBefore*→file) events.pageis the record that gets saved.originalis the stored revision, andinputis the request, where those exist.pagestarts as a copy, so editing it never changesoriginalorinput. Whateverpageholds after the handlers run is what's saved. Authorization still runs first, and a handler that throws still stops the save.page.beforeCreate{ input, page }page.beforeUpdate{ original, input: { id, data }, page }.pageisoriginalwith the update applied.page.beforePublish{ original, page }page.beforeCreateRevisionFrom{ params, original, page }This changes the payload of all four events. Handlers that read
event.payload.pageon publish, or that changedinputon create or update, have to switch to the new fields.Supporting changes:
PublishEntryUseCaseaccepts optionalvalues, so the handler's page can be published. They go through the normal publish validation, and existing callers are unaffected.page.beforePublishhandler inapi-website-builder-workflowsnow readsoriginal.pages.beforeEvents.test.tschecks that a handler replacingpagegets it saved, for all four events. It also checks thatoriginalis left alone, and that a handler that throws stops publish and create-revision-from.Restore isn't covered.
page.beforeRestorecan't change the saved data yet.Changelog
Title: Page event handlers can change the page before it is saved
Body: Changes that page event handlers made before publishing a page, or before creating a new revision of it, were not saved. They're now saved, and all page "before" events give handlers the page to change in the same way content entry and file events do.
Squash Merge Commit
Workspace: wby-next6 · 🧹 Forth - 6.5.0 Fixes
🤖 Generated with Claude Code