Skip to content

CMS tree duplicates current child page #2137

@HeyImPhil

Description

@HeyImPhil

Module version(s) affected

3.1.x

Description

When the CMS has large number of pages it defaults to collapsing child menus. When the parent menu is expanded in some cases the current selected child page will show twice.

Image

How to reproduce

  1. Create a large number of top level pages ~50
  2. Add child pages to a few top level pages
  3. Open sub menu and click on a child page
  4. Refresh the page

Expected:
The current item will have the selected class and shown with the parent expanded

Result:
The parent is not open and once expanded the child page is shown twice without either having the selected class

Possible Solution

I can see the getSubtree request returns only one item that looks correct.

<li id="record-45" data-id="45" data-recordtype="Page" class="jstree-leaf closed class-Page">
      <ins class="jstree-icon font-icon-right-dir">&nbsp;</ins>
      <a href="admin/pages/edit/show/45" title="(Record type: Page) Child Page">
          <ins class="jstree-icon font-icon-drag-handle">&nbsp;</ins>
          <span class="text">
              <span class="jstree-recordicon record-icon font-icon-page class-Page"></span>
              <span class="item" data-allowedchildren="[{&quot;ClassName&quot;:&quot;Page&quot;,&quot;Title&quot;:&quot;Page&quot;,&quot;IconClass&quot;:&quot;font-icon-page&quot;},{&quot;ClassName&quot;:&quot;SilverStripe\\ErrorPage\\ErrorPage&quot;,&quot;Title&quot;:&quot;Error Page&quot;,&quot;IconClass&quot;:&quot;font-icon-p-error&quot;},{&quot;ClassName&quot;:&quot;SilverStripe\\CMS\\Model\\RedirectorPage&quot;,&quot;Title&quot;:&quot;Redirector Page&quot;,&quot;IconClass&quot;:&quot;font-icon-p-redirect&quot;},{&quot;ClassName&quot;:&quot;SilverStripe\\CMS\\Model\\VirtualPage&quot;,&quot;Title&quot;:&quot;Virtual Page&quot;,&quot;IconClass&quot;:&quot;font-icon-p-virtual&quot;}]">Child Page</span>
          </span>
      </a>
  </li>

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions