Multiselect skips first element with special character in field inside a Structure

Hi Kirby Community,

I think I might have stumbled into a bug, that took me all afternoon to understand what is happening.

So I have a structure under the $site, with teammembers. This structure has the following yml:

fields:
          name:
            label: Full Name
            type: text
          shortname:
            label: Author Key
            type: text
            help: Used to link this team member as an article author.
          role:
            label: Role Name
            type: text
          picture:
            label: Photo
            type: files
            multiple: false
            query: site.find("teammembers").files
            uploads:
              template: image
              parent: site.find("teammembers")
          description:
            label: Description
            type: textarea
          linkedin:
            label: LinkedIn URL
            type: url
          roleLevel:
            label: Role Level
            type: toggles
            options:
              - value: "consultant"
                text: Consultant
              - value: "management"
                text: Management
              - value: "expert"
                text: Expert
            default: consultant

The teammembers are being uploaded to its own folder, under site. Everything is ok until here, and I can, despite the multilingual settings, all work as expected.

In a block, I am doing a query to fetch these teammembers in several different places around the website, and for example, I have one block that displays only the ones with the rolelevel set to ‘experts’ or ‘management’:

name: Team List Managers / Experts
icon: users

preview: fields
fields:
  members:
    label: Members
    type: multiselect
    options:
      type: query
      query: site.teammembers.toStructure.filterBy('rolelevel', 'in', ['management', 'expert'])
      text: "{{ item.name }} ({{ item.rolelevel }})"
      value: "{{ item.shortname }}"

The weird behavior: The first person is “Tobias“, and the second one is “Jürgen“, and the list follows. Kirby skips and doesn’t show the ‘Jürgen’ in the list, nor recognizes him in the list at all, in the panel, for the multiselect. When I “force“ him into the content directly, it also doesn’t work, and it throws several errors.

As I have a list of 70 people in the teammembers structure, I simply moved “Jürgen“ down the list, after another person with a name with special character (but rolelevel = ‘consultant‘), and it magically appeared in the list.

I don’t understand nor get what is going on, and I would like to make it work as it should, with the correct order and the multiselect working as it should.

Does anyone also experienced something like this?

Thanks in advance for reading this!

Does this only happen with when you use the select inside a block or can you reproduce the behavior also with the same multiselect field directly in the page blueprint (not nested in a block or so)?

Hi @texnixe thanks for the answer and sorry for the delay. Just tested it, and this behavior only happens inside a block. On the page it works perfectly as expected.

Update on the topic: I thought it had to do with special characters, but it seems it doesn’t. Another block, in the same structure, I have the same weird behavior. It is randomly now not displaying a person whose name is “Stefan”, no special characters involved, and only in the translated version of it. I am getting crazy with this, as I already triple checked several times. If anyone knows what can be done to fix this weird behavior, or has any hint, I would appreciate a lot. Thanks in advance :slight_smile:

Let me try to reproduce…

Are you using the latest Kirby 5 version? Please also try with the latest RC 5.0.4.

If you set up a small test in a fresh Starterkit, can you reproduce it?

Maybe it would be better to use pages for these members, it’s a lot of data for a structure field after all.

Hi @texnixe , thanks for this. I am using already 5.0.4, and also tried with RC 5.1.0. The last one gave other erratic behaviors in translated pages (not the default language) with the same structure. The behavior is erratic and sometimes unpredictable. Sometimes restarting the server on localhost changes which members show up in the query too.

I am truly starting to believe that 70 items is a little bit too much for the Structure to work with, and do queries over it. I will shift to pages as you suggested. But just for future reference, what’s the general limit for a structure?

Another hint I discovered: It’s has nothing to do with the special character, but with the second element. It is always the second member that is being ignored by the multiselect. And not in the main language - actually only in the secondary language.

I will setup a test with a Starterkit and let you know afterwards. Thanks for the support so far. Kirby is one of the best CMS I used in the last years, and for sure, the community plays a great role in this :slight_smile: