Deleting a page that is the first entry in a multiselect with multiple selected pages breaks the panel

I have a team page with child pages for team-members. The team page also has a tab for departments which has a structure field with a field for the department name and a multiselect for team-members who belong to the department.
Deleting a team-member page that is selected as the first entry in the multiselect of a department which contains more than 1 member, the department tab breaks and shows “ is not a function”. The behaviour does not happen if the team-member is alone in the department or any entry apart from the first.

Is there anything I may have done wrong in the blueprint which causes this error to occur?

Can’t reproduce your issue.

Btw: It helps a big deal if you post code as code instead of screenshots! Thank you!

This is the team.yml:

title: Team
  status: false
  delete: false

    label: Teammitglieder
        label: Teammitglieder
        info: "{{ page.position }}"
        template: team-member
        type: pages
        layout: cards

    label: Abteilungen
        type: fields
            label: Abteilungen
            type: structure
                type: text
                label: Abteilungsname
                label: Abteilungszugehörige
                type: multiselect
                  type: query
                  query: page.children.listed

  departmentname: Testdepartmen
  members: team/test-1, team/test-2

In this situation, deleting the team-member test-1 will break the department tab and cause the “ is not a function” error. Deleting test-2 does not.
If there was only test-1 in the department, it would work fine as well without any errors.

Deleting any of the team-members doesn’t remove them from the txt-file in content, unless I change something else about the multiselect and save again.

What’s your Kirby version? I tested your example in a 3.9.0/3.9.1 Starterkit without any issues.

So created three listed team-member pages, selected two, then deleted the first in the list of members. All good.

Only one member is shown in the preview, although 2 are still stored in the file at this point.

Please check if you can reproduce this issue in a fresh Starterkit.

I’m embarassed to say that going from 3.9.0 to 3.9.1 seems to have fixed it. I should’ve tried that before asking on the forum.
Thank you and sorry for wasting your time.