Skip to content

[4.x]: Maintain hierarchy in entry field has unexpected results on changing the target hierarchy #16843

@hiasl

Description

@hiasl

What happened?

Description

We have an entry field with a checked "Maintain hierarchy" checkbox

This entry field's target is limited to a structure section (2 levels allowed) called "properties"

For this example we have the following 3 entries in our properties structure, looking like that:

  • Entry 1
  • Entry 2
    • Entry 2-1

To show the problem, we create a new entry called "problem". In this Entry we select "Entry 2-1" in the "entry field", which is then shown as as "Entry 2 > Entry 2.1" in the field. We save the Entry "problem".

Next we move "Entry 2-1" in section "properties" to be the new "Entry 1-1" (we drag it from being the child of "Entry 2" to being the child of "Entry 1".

After that, we open our Entry "problem" again. The entry field now has 2 relations, one to "Entry 2" and one to "Entry 1-1" (without showing the hierarchy from "Entry 1"). When we save the Entry "problem" and reopen it, the entry field now shows the hierarchy "Entry 1 > Entry 1-1" AND still Entry 2.

Steps to reproduce

see above

Expected behavior

After dragging Entry 2-1 to the position 1-1, the problem entry should update and only have one relation in the entry field linking to Entry 1-1 including hierarchy.

Actual behavior

2 relations are shown in Entry "problem". After saving and reopening it still show 2 relations, but the first one with hierarchy again.

Craft CMS version

4.14.5

PHP version

8.2

Operating system and version

Linux

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions