webiny / webiny-js

Open-source serverless enterprise CMS. Includes a headless CMS, page builder, form builder, and file manager. Easy to customize and expand. Deploys to AWS.
https://www.webiny.com
Other
7.22k stars 589 forks source link

fix(app-headless-cms): fixing useParentField hook for high level parents #4164

Closed ma-schmidt-de closed 3 weeks ago

ma-schmidt-de commented 3 weeks ago

Refs: #4163

Changes

Just a tiny fix to the useParentField() hook. In case of level>0 it was calling function getParentField() with a wrong level. Closes #4163

How Has This Been Tested?

Manually with an in-code content model product and a field decorator ProductRenderDecorator. See #4163 for more details. This test setup provides the expected console log after the fix:

current field is metaData.generalMetaData.specificMetaData.isoCode
1st level parent: specificMetaData
2nd level parent: generalMetaData
3rd level parent: metaData

Documentation

not needed