feat!: fix non-functional custom RSC component handling, separate label and description props, fix non-functional label function handling
Description
RSC Custom Components fix
The goal for custom components is to pass in payload if they are server components. This never happened, as our logic for detecting RSCs was broken. This is now fixed.
Additionally, the BeforeLogin and AfterLogin custom components are now handled properly, which allows us to inject the payload prop into them if they are RSCs.
Labels fix
Currently, admin.description (for fields) can be a
- string
- function (with
tas argument) which returns string - Client Component
- RSC
The problem: there is no reliable way to discern between functions and RSCs.
If it is a function returning a string, we want to insert it as text into the default Description component.
If it is a RSC, we want to completely replace the default Description component.
Solution: We have separated the props
We already have admin.components. So we split up admin.description into:
admin.description - now only accepts string or function returning a string
admin.components.Description - accepts RSC or Client Component
More details on the specific changes are in the breaking changes list.
Additionally, the globalConfig.admin.description and collectionConfig.admin.description functions now have access to the t prop.
Broken i18n label functions
This used the sanitized field name (Url) as the label, as fields:enterURL was never resolved. So yea, any custom label function which used the t function like that did not work.
Breaking Changes
- Globals config:
admin.descriptionno longer accepts a custom component. You will have to move it toadmin.components.elements.Description - Collections config:
admin.descriptionno longer accepts a custom component. You will have to move it toadmin.components.edit.Description - All Fields:
field.admin.descriptionno longer accepts a custom component. You will have to move it tofield.admin.components.Description - Collapsible Field:
field.labelno longer accepts a custom component. You will have to move it tofield.admin.components.RowLabel - Array Field:
field.admin.components.RowLabelno longer accepts strings or records - If you are using our exported field components in your own app, their
labelPropsproperty has been stripped down and no longer contains thelabelandrequiredprop. Those can now only be configured at the top-level
- [ ] I have read and understand the CONTRIBUTING.md document in this repository.
Type of change
- [ ] Chore (non-breaking change which does not add functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Change to the templates directory (does not affect core functionality)
- [ ] Change to the examples directory (does not affect core functionality)
- [ ] This change requires a documentation update
Checklist:
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] Existing test suite passes locally with my changes
- [ ] I have made corresponding changes to the documentation