Multiselect with options query and BoostID stopped working

Hi!

I updated a blog from K3 to K4, I noticed that in the panel my highlight multiselect stopped working, i see this error in the console:

TypeError: Cannot read properties of undefined (reading 'length')
When I want to add a new post to the highlight multiselect field.

My blueprint looks like that:

type: multiselect
options: query
query:
  fetch: kirby.collection('boostidkvscachedstories')
  text: "{{ arrayItem.text }}"
  value: "{{ arrayItem.value }}"
search:
  min: 3
  display: 10

The collection is created using the BoostID plugin:

<?php
return fn () => lapseStatic(__FILE__, function () {
    return collection('boostidkvs')->filterBy(
        function ($kvObject) {
            if ($kvObject->template === 'article') {
                return boost($kvObject->value);
            };
            return null;
        }
    );
});

In the frontend when I dump the collection it returns the intended UUID:

Kirby\Cms\Collection Object
(
    [0] => 3hrj3cep
    [1] => X5PnTAtB0WP1lu89
    [2] => g6c48myg
    [3] => zl80kri6
    [4] => fpw9v4y4
    [5] => 58gckd4v
…

Any idea how this could be solved?

Gosh… what a stupid error, didn’t update the syntax of the multiselect:

this is working:

type: multiselect
        options:
          type: query
          query: kirby.collection('boostidkvscachedevents')
          text: "{{ arrayItem.text }}"
          value: "{{ arrayItem.value }}"

Replacing my fetch to query did the trick. Leaving this here in case :expressionless:

thanks @cbtr i create a new release including the updated blueprints

@bnomei as always appreciate your reactivity. Just an important note, I just noticed that when adding the option search to the extended fields, it stops working again. Don’t know if it’s a bug with Kirby 4?

type: multiselect
options:
  type: query
  query: kirby.collection('boostidkvscachedstories')
  text: "{{ arrayItem.text }}"
  value: "{{ arrayItem.value }}"
# Not working with these options:
#search:
#  min: 3
#  display: 10
1 Like

@texnixe actually only the min: 3 is breaking the search option. any ideas why? the demo data set from the plugin has 16 values to be queried.

there is no error in the console but the UI show a tiny line instead of the full popup when the user clicks inside the field to trigger the popup.

Hm, I cannot reproduce this in a starterkit with the notes collection. But what I am getting is a basically empty list with arrayItem instead of item (which is the current syntax for all kind of items no matter the collection).

      multiselect:
        type: multiselect
        options:
          type: query
          query: kirby.collection('notes')
          text: "{{ item.title }}"
          value: "{{ item.id }}"
          search:
            min: 3
            display: 10

boost is forwarding a collection of \Kirby\Toolkit\Obj to the panel. using item does not seem to work properly then either. I will keep investigating. Thanks for checking with the starterkit. :pray: