getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.27k stars 167 forks source link

[3.8.0-rc.1] blocks and layout field issues within object field #4690

Closed afbora closed 2 years ago

afbora commented 2 years ago

Getting following error when using blocks and layout fields within object field

Cannot read properties of null (reading 'length')

fields:      
  person:
    label: Person
    type: object
    fields:
      blocks:
        type: blocks
      layout:
        type: layout

Additional context

Seems to happen when the field is named blocks and layout, works if you give it another name.

afbora commented 2 years ago

Issue summary

The issue is setting field value as null and coming from following line: https://github.com/getkirby/kirby/blob/3.8.0-rc.1/panel/src/components/Forms/Field/ObjectField.vue#L99

Possible solution

It works when field.value or empty string is returned instead of null. However, I think that the value prop of all fields should return the type it supports in order for it to work more stable in the future.

bastianallgeier commented 2 years ago

@afbora can you check if this PR also fixes this problem? https://github.com/getkirby/kirby/pull/4699

afbora commented 2 years ago

@bastianallgeier Unfortunately no.

bastianallgeier commented 2 years ago

@afbora it was completely unrelated, but this should fix it: https://github.com/getkirby/kirby/pull/4700

bastianallgeier commented 2 years ago