Hot reload error: Uncaught (in promise) DuplicateFieldName: A field with the name 'createdBy'
Closed this issue · 5 comments
Hey, Thanks for the author fields plugin!
We're in the process of upgrading to Payload v2. While working on some customer components, this error would occur with each hot reload.
Steps to reproduce:
- Create a collection
- Add something that you can change to the collection edit view. I was updating the graphics component in the payload config.
- Go to a collection edit view, update the component, and save the file.
- The error will block the hot reload.
Thanks for all your work!
package.json
"@boomworks/payload-plugin-author-fields": "^1.1.8",
"payload": "^2.9.0",
sanitize.js:81 Uncaught (in promise) DuplicateFieldName: A field with the name 'createdBy' was found multiple times on the same level. Field names must be unique.
at http://localhost:4000/admin/main.js:209010:23
at Array.map (<anonymous>)
at sanitizeFields (http://localhost:4000/admin/main.js:208954:19)
at sanitizeCollection (http://localhost:4000/admin/main.js:207351:53)
at http://localhost:4000/admin/main.js:207571:85
at Array.map (<anonymous>)
at sanitizeConfig (http://localhost:4000/admin/main.js:207571:45)
at buildConfig (http://localhost:4000/admin/main.js:207388:62)
Hi @gamellis - I haven't been able to reproduce this issue - are you able to provide a minimal reproduction?
You know it! Here's a repo with the bug in action https://github.com/gamellis/payload-reproduce-hotreload
Head to the posts collection and load the edit form. I commented on where to add the element in the custom component. After you save the change, the edit form will throw the error when the hot reload fires.
Thanks for that, can see the error now & think I know what's causing it - will hopefully get some time in the next couple of days to dig into it
Hi @gamellis - this should be fixed now in v1.1.9
Thanks!