Structure field error: Cannot read property 'length' of undefined

Hi,

we are about to do the final transition from K2 to K3 (3.3.0) with our project. I just converted all content files with the upgrade script at https://getkirby.com/docs/cookbook/setup/migrate-site#folder-and-file-structure. Most of the content seems to work fine.

However, we use structure fields as participants lists. When I try to open the migrated participants lists in the panel, instead of the structure field it shows a red error box with the message “Cannot read property ‘length’ of undefined”.

This occurs with most of the participants lists but not all (maybe not the more recent ones or the ones with just one or two entries?).

This is what I get in the console:

Can this be related to some broken formatting or invalid characters in the content TXT file? Any hints what to look for? (As I cannot share the original files with names and addresses)

Will be fix in 3.3.1:

Thanks for your swift reply!

When will 3.3.1 be released?

Not sure, but i guess pretty soon. . Does the error go away if you remove sortby?

@texnixe yes, this “fixed” it. Do you mean “pretty soon” as in “within the next 7 days” or “within the next 4 weeks”?

I don’t know, I would have expected the next rc next Tuesday, but won’t make any guesses because of bt conf.

I copied the file edited to fix a bug that will released in 3.3.1 :sweat_smile: I’ll just update when it’s officially released. If you really needed maybe you can check the files edited?

When we talked to @bastianallgeier , he said we could take it next week.

1 Like

As soon as I add sortBy to the structure field type I get the error “Cannot read property ‘length’ of undefined”. Is this still a bug in 3.3.1?

@johan Could you please post your blueprint?

Sorry my blueprint is very rough, testing at the moment.

          style:
            label: Style
            sortBy: option desc
            translate: false
            type: structure
            fields:
              option:
                label: Option
                options:
                  alignment: Alignment
                  test: Test
                type: select
              alignment:
                default: align-center
                label: Alignment
                options:
                  align-center: Center
                  align-left: Left
                  align-right: Right
                required: true
                type: select
                when:
                  option: alignment
              test:
                default: align-center
                label: Alignment
                options:
                  align-center: Center
                  align-left: Left
                  align-right: Right
                required: true
                type: select
                when:
                  option: test

When I add sortBy: option desc:

Just now when I posted the blueprint I realized how stupid it is :slight_smile: I’m still using the structure field but removed the option field, and just have (max: 1) one line of input. Won’t need the sortBy at the end. Sorry! But still, maybe this is a bug?

Hm, I just added the above field definition in a fresh 3.3.1 Starterkit without any issues.

Hm that’s weird :thinking:

Which browser and OS are you using?

Mac, Mojave, Chrome version 78.

A mystery, I’m on Mac OS Mojave myself, checked Chrome, no error.