Open yulolimum opened 10 hours ago
Hello, this originally was observed with the example app's "slug" field. However this was reproduced on a fresh payload app.
Setting up a beforeValidate hook to transform a field value works on both create and update. But...
beforeValidate
create
update
During create the transformation is immediately available in the UI. I suspect due to the page path going from /create -> /{resource_id}
/create
/{resource_id}
During update the transformation runs, butis not reflected in the UI.
Here is a video demoing the issue:
https://github.com/user-attachments/assets/e8f0d17a-e8ed-441e-ad7a-2ff96cb1612d
https://github.com/yulolimum/tmp-payload-before-validate-repro
Clone Repo
git clone git@github.com:yulolimum/tmp-payload-before-validate-repro.git
Install Deps
cd tmp-payload-before-validate-repro yarn
Start Dev Server
yarn dev
Login
repro@payload.com
repro
Create a New User
Update the User
Refresh the Page
area: core
Binaries: Node: 22.11.0 npm: 10.9.0 Yarn: 4.5.2 pnpm: N/A Relevant Packages: payload: 3.0.2 next: 15.0.3 @payloadcms/db-mongodb: 3.0.2 @payloadcms/email-nodemailer: 3.0.2 @payloadcms/graphql: 3.0.2 @payloadcms/next/utilities: 3.0.2 @payloadcms/plugin-seo: 3.0.2 @payloadcms/richtext-lexical: 3.0.2 @payloadcms/translations: 3.0.2 @payloadcms/ui/shared: 3.0.2 react: 19.0.0-rc-65a56d0e-20241020 react-dom: 19.0.0-rc-65a56d0e-20241020 Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 Available memory (MB): 65536 Available CPU cores: 10
Describe the Bug
Hello, this originally was observed with the example app's "slug" field. However this was reproduced on a fresh payload app.
Setting up a
beforeValidate
hook to transform a field value works on bothcreate
andupdate
. But...During
create
the transformation is immediately available in the UI. I suspect due to the page path going from/create
->/{resource_id}
During
update
the transformation runs, butis not reflected in the UI.Here is a video demoing the issue:
create
.update
), you will see the field will only change after a page refresh.https://github.com/user-attachments/assets/e8f0d17a-e8ed-441e-ad7a-2ff96cb1612d
Link to the code that reproduces this issue
https://github.com/yulolimum/tmp-payload-before-validate-repro
Reproduction Steps
Clone Repo
Install Deps
Start Dev Server
Login
repro@payload.com
repro
Create a New User
Update the User
Refresh the Page
Which area(s) are affected? (Select all that apply)
area: core
Environment Info