Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app-headless-cms): add support for nested dynamic zones and ref fields #3471

Merged
merged 9 commits into from
Aug 31, 2023

Conversation

Pavel910
Copy link
Collaborator

@Pavel910 Pavel910 commented Aug 14, 2023

Changes

This PR unlocks the ability to nest dynamic zone fields within object fields, within other dynamic zones, and also have ref fields within dynamic zones. Filtering of content entries within dynamic zones is still not possible.

This PR also improves the performance of reference field mapping which is executed during create and update CRUD operations.

Other changes:

  • add object field transformer (client side)
  • improve dynamic zone transformer (client side)
  • move prepareFormData to @webiny/app-headless-cms-common, as it is being used in recursive functions
  • move createFieldsList to @webiny/app-headless-cms-common, as it is being used in recursive functions
  • dynamic zone without templates can be added to the content model, but it will not be added to the GraphQL schema, nor will it be rendered in the UI, until it contains at least 1 template
  • empty object fields can now be saved in the content model, and GraphQL schema will contain a dummy _empty: String field, until some user-defined fields are added to the object. The same thing applies to empty dynamic zone templates.
  • a jest test that was testing an empty object field was removed, since we now generate a valid GQL schema, and that is tested in many other places

This is an example of what you can now do in your content models:
image

CleanShot 2023-08-18 at 10 10 21

How Has This Been Tested?

Jest tests on the API side, and manually on the client side.

@Pavel910 Pavel910 added this to the 5.38.0 milestone Aug 14, 2023
@Pavel910 Pavel910 self-assigned this Aug 14, 2023
@Pavel910 Pavel910 changed the title Add support for nested dynamic zones and ref fields feat(app-headless-cms): add support for nested dynamic zones and ref fields Aug 21, 2023
# Conflicts:
#	packages/api-headless-cms/src/graphqlFields/dynamicZone/dynamicZoneStorage.ts
#	packages/app-headless-cms/src/admin/components/ContentEntryForm/useContentEntryForm.ts
@Pavel910 Pavel910 merged commit ec04ae7 into next Aug 31, 2023
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants