BeforeChange Hook is not deleting the field ID #1385
Unanswered
MahmoudAli1
asked this question in
Q&A
Replies: 2 comments
-
@denolfe @pixelistik @klapec @sangallimarco |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey @MahmoudAli1 — so the IDs that are created in fields like arrays and blocks is used in a few places. It is used to maintain unique array row IDs in the frontend, and is also used to make sure that you can pass in partial values to array rows in Payload is not designed to remove the I'm going to convert this to a discussion but we can keep the conversation going there! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Report
When I define my fieldhook to customize the value that I want to save in the document for a specific collection, I get an error of TypeError: Cannot create property 'id' on string 'whatever value I enter here' knowing that I'm using TypeScript for this project.
Current Behavior
The value is saved with an id and I want to customize data beforeChange so I can get rid of the id and the object that get created by default in the array
As an example
For Array called arr
If I created a field called cuisine with type text the result will be
arr = [{'cuisine':'food', id:'6364afbf6243095927619de7'}]
meanwhile I want to have
arr = ['food']
Expected Behavior
I expect to have the ability to drop id when I perform beforeChange hook since I can control the shape of the value I'm passing at that time.
Steps to Reproduce
Detailed Description
My package.json
And this is the schema that I want to match
Beta Was this translation helpful? Give feedback.
All reactions