Hello,

first and foremost, I did search around the issue queue for my specific problem, but could not find something related to my problem, (except one, which I'll link to in a minute).

Problem :

I have a vocabulary consisting of three parents, and each of those parents has a lot of children, which in turn have a lot of children (max_level : 4). And I do mean a lot : first parent has 250 + terms alltogether.

When I go the the Term Overview page, I see all of the children of the first parent, and the pager says 3 pages are to follow. Now what happens is, if I go the next page I see the exact same output of the first page, and my second parent at the bottom. The same happens when I go to page 3, but then it shows the remaining 2 parent terms.

Research :

I've been digging in code (more specifically in /core/modules/taxonomy/src/Form/OverviewTerms.php ) where I came across this code :

// Do not let a term start the page that is not at the root.
      $term = $tree[$tree_index];
      if (isset($term->depth) && ($term->depth > 0) && !isset($back_step)) {
        $back_step = 0;
        while ($pterm = $tree[--$tree_index]) {
          $before_entries--;
          $back_step++;
          if ($pterm->depth == 0) {
            $tree_index--;
            // Jump back to the start of the root level parent.
            continue 2;
          }
        }
      }

Now, what I believe this does is quite simple : when deciding the terms to render on a page, it checks if a term is indeed at the root level before 'cutting it' at that term and displaying the rest at the next page. What happens in my case is that , because I have 3 parent terms and the first one has 250+ children, the parent and its children are all displayed on the pages, because it never gets to 'cut' the array of terms to show.

Hence, it just shows everything until it reaches the next root (which is my second parent).

(I know, my phrasing could be a bit better, but I believe you know what I mean :) )

The pagination just says three pages, because it divides the total number of terms (250+) in 'chunks' of 100 (the setting in taxonomy config files).

Now, I do believe this 'works as designed', because the pagination is correct in assuming there will be three pages (in my case), but there should be a better way to display a root parent term with 100+ terms, because this is the real issue here : any root parent term with 100+ children will be displayed in this manner.

I do believe this is related to https://www.drupal.org/node/242324 , which is where this code was introduced in the first place. And for 99% of the websites, this will work like a charm, but in this case it does not :)

ATM I'll be investigating contrib modules to adress this problem, as I do not see an easy solution for this. I just thought I'd mention this problem.

I haven't supplied screenshots, because of the amount of terms. If need be, I'll supply some.

Comments

Alienpruts created an issue. See original summary.

ashopin’s picture

I can confirm that we're seeing the issue as well with a top level item with a lot of children.

In our case, changes to the page don't save.

mattjones86’s picture

Version: 8.1.x-dev » 8.4.x-dev
Priority: Minor » Normal

I've got the same issue, only it's worse because I'm looking at ~2000 children split over 5 or 6 levels.

All these are contained within 3 top level parents and actually causes the browser to freeze for long periods of time as it init's the drag and drop.

I believe this a functionality breaking bug for some use cases and should be considered more important than 'Minor' as it renders the interface completely unusable for large hierarchical taxonomy (like categories). I'm bumping to Normal in the hope it gets some more attention.

There should really be a separate vocabulary configuration option available which allows only one level of terms to be displayed at a time, perhaps showing the number of children contained underneath and the option to dig down to the next level or navigate back up to a higher level within the taxonomy.

Does anyone know of a contrib module which solves this problem?

EDIT: taxonomy_manager seems to do a pretty decent job at solving this, but it would still be nice to have something included in the core.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

greendemiurge’s picture

I spent some time looking into this and I agree it does run painfully slowly when a large number of subordinate terms are linked. The code section in question does indeed ensure that the tree rendered to the page must start on a root item.

Design-wise, I could see a solution where we permitted a continuation of listings on a subsequent page, such as:

<page 1>
Category 1
  {...items 1-10 out of 10}
Category 2
    {...items 1-90 out of 140}

<page 2>
Category 2 (continued)
    {...items 91-140 out of 140}

That would not be too difficult to accomplish, but I see 2 major issues with the design:
1) Re-ordering weights via dragging would not be workable. Granted they would work super-slowly with a large data set, but they would not work at all if the page truncates the list.

2) Multiple layers of nesting would be visually confusing. The above example isn't awful, but what if we ended up in a place where we had this:

<page 5>
Category 2 (continued)
  Subcategory 3 (continued)
     Sub-subcategory 1 (continued)
        {...items 18-118 out of 130}

That would be pretty nightmarish, if rare.

The way I see it, what we have may be the least-worst scenario already. taxonomy_manager may be the best way to go for edge cases.

The one thing I would point out, though, is that the pager is currently buggy. If you have 1000 sub-categories nested in 2 categories, and a max of 100 records per page, you get a pager with 11 pages, all of which have the exact same content on them, because apparently the pager just divides the number of records total by the number per page. Clearly it would be better if we ensured that the 2 root categories ended up each with their own page and only had 2 pages in the pager.

rojan raj’s picture

I am having the same issue as well. Any solutions or patches?

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kyuubi’s picture

Bumping into this as well.

usmanjutt84’s picture

I can confirm this bug as well.

I have 200+ parent terms and have 21000+ its child and its child (3 Level). The pagination is correct.
One parent has 1050 child+sub-child. This parent located on /admin/structure/taxonomy/manage/VOCAB_NAME/overview?page=48 and all 1050 terms is rendered on the same page.

Technically, 1050 terms should have 11 pages in pager and 1st page starts at /admin/structure/taxonomy/manage/VOCAB_NAME/overview?page=48 for this parent. These 1050 terms repeats on the next 10 pages as well until we reach at 58.

Looking forward from the community for solution.

usmanjutt84’s picture

Priority: Normal » Critical

As #3 said

this a functionality breaking bug for some use cases and should be considered more important than 'Minor' as it renders the interface completely unusable for large hierarchical taxonomy.

This issue should not be on Normal priority. We should consider it as critical.

catch’s picture

Priority: Critical » Major

https://www.drupal.org/core/issue-priority has the criteria for issue priority. Given this is causing browsers to lock up on those pages, it can probably be considered major, but given it's isolated to one admin page, it would be more properly normal. Moving to 'major' for now.

Note that there are contrib modules that replace the taxonomy administration interface like https://www.drupal.org/project/taxonomy_manager

This probably can't be fixed without a complete refactoring of drag and drop hierarchy.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

kyuubi’s picture

Bear in mind that https://www.drupal.org/project/taxonomy_manager is currently not being properly maintained in D8 afaik.

For example https://www.drupal.org/project/taxonomy_manager/issues/3046752 which makes the module pretty much unusable for fielded terms has been opened for a year.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

miha.wagner’s picture

Can also confirm this is an issue on parents with several hundred children.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.