Skip to content

Parent page duplicated on huge use with menu_order in dropdown #12795

@kent1D

Description

@kent1D

Describe the bug
Context: on a website with a lot of pages on 0/1/2/3 or 4 sublevels depending on the 1st level page, using menu order on first level but also sometimes on sublevel, the dropdown duplicate some pages and doesn't show all.

Debugging:

  1. i duplicated the selector and changed the query to sort by ID, it's working fine. So to make it work change orderby menu_order to orderby id
  2. the bug is in the function "buildTermsTree" here
    export function buildTermsTree( flatTerms ) {
  3. after logging a bit it seems to be in the use of groupBy (from lodash) here:
    const termsByParent = groupBy( flatTerms, 'parent' );

In my tests, the param flatTerms looks fine in both cases, but termsByParent is different

To Reproduce
Steps to reproduce the behavior:

  1. Create 300 pages on different sub levels
  2. Set menu order on some of them
  3. Edit a page and try to choose en parent page
  4. See what is the result

Expected behavior
No duplicate content

Screenshots

capture d ecran 2018-12-11 a 13 23 18

Additional context

  • This appears in the last version of Gutenberg (4.7.0 RC and 4.6.1 on Wordpress 4.9.8 and on Wordpress 5.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Document SettingsDocument settings experience[Type] BugAn existing feature does not function as intended

    Type

    No type
    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