Skip to content

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

Closed

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)

Activity

  1. kent1D commented on Dec 11, 2018

    @kent1D
    Author

    The best way to solve it may be to:

    • get the posts ordered by id
    • keep the menu_order in the datas here like adding order: item.menu_order,
    • use orderBy(..., 'order') from lodash to sort by menu_order then
  2. added
    [Type] Bug
    [Feature] Document Settings
    Needs Testing
    on Dec 11, 2018
  3. MarkPraschan commented on Jan 31, 2019

    @MarkPraschan

    I am seeing this same behavior (duplicates and missing pages) with WordPress 5.0.3. We have over 500 pages. I'm not sure if order has been set on any. The parent page dropdown from within Quick Edit still works correctly.

  4. lakellie commented on Feb 6, 2019

    @lakellie

    This issue was reported by a WordPress.com user with an Atomic site.

  5. marjesch commented on May 12, 2019

    @marjesch

    I have the same issue too. I have a large site with over 500 pages and my issue is exactly as described above.

  6. LuckyTime154 commented on Nov 2, 2019

    @LuckyTime154

    I have the same issue. 500+ pages. It's been a year...Is WP planning to fix this or shall we give up on Gutenberg (again)?

  7. talldan commented on Apr 20, 2020

    @talldan
    Contributor

    Possibly related: #21563

  8. bobbingwide commented on Jul 1, 2020

    @bobbingwide
    Contributor

    I also reported this problem in #13618 (comment) and reproduced it today with Gutenberg 8.4.

    See also TRAC 46294 https://core.trac.wordpress.org/ticket/46294

  9. added 7 commits that reference this issue on Jul 2, 2020
  10. DimitriDV commented on Oct 2, 2020

    @DimitriDV

    Schermafbeelding 2020-10-02 om 09 52 37

    I have the same issue!

  11. removed
    Needs Testing
    on Feb 4, 2021
  12. Mamaduka commented on Mar 27, 2025

    @Mamaduka
    Member

    I can no longer reproduce this issue. I believe it was resolved via #25267, when the component was refactored to use combobox.

    I'm going to close the issue. Feel free to reopen it with reproduction steps if you're still experiencing the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Document Settings[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions