Skip to content

Corrupted collection hierarchy after deleting and creating multiple sub-collections #2232

@Huncsuga

Description

@Huncsuga
  • Lunar version: 1.0.0-beta21
  • Laravel Version: 12.19.3
  • PHP Version: 8.3.22
  • Database Driver & Version: MySQL 8.0.42

Expected Behaviour:

When creating and managing nested collections, the breadcrumb and ancestor structure should remain consistent. Removing and creating sub-collections should not corrupt the nested set hierarchy.

Actual Behaviour:

After deleting and creating sub-collections, the ancestor tree becomes corrupted: breadcrumbs start displaying incorrect paths, sometimes including sibling collections or even descendants of siblings. Looking at the database reveals that _lft and _rgt values are no longer valid.

Steps To Reproduce:

  1. Create 3–4 parent collections (e.g. A, B, C).
  2. Under each collection, create 4–5 sub-collections.
  3. Delete 2–3 sub-collections from multiple parent collections (not just one).
  4. Then create 2–3 new sub-collections (again under different parents).
  5. Go to the admin panel and view the breadcrumbs or use the ancestors() method.
  6. Notice that the breadcrumb includes incorrect parent paths — e.g. shows siblings or their children instead of true ancestors too.
  7. Inspect the _lft and _rgt values in the database — they are out of sync and appear incorrect.

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