bcgov / MFIN-Data-Catalogue

The Finance Data Catalogue enables users to discover data holdings at the BC Ministry of Finance and offers information and functionality that benefits consumers of data for business purposes. The product is built using Drupal and adheres to the Government of BC's Core Administrative and Descriptive etadata Standard.
Other
6 stars 0 forks source link

Pager not working as expected for taxonomy overview page #441

Closed CraigClark closed 7 months ago

CraigClark commented 7 months ago

OP timer

https://openplus.monday.com/boards/4092908516/pulses/6498638475


[!IMPORTANT] I have listed this as a medium priority task for now. There are ways to manage this vocabulary, but the core taxonomy manager should work.

Describe the bug

Drupal's taxonomy overview page for information schedule. /admin/structure/taxonomy/manage/information_schedule/overview is not behaving as expected.

This vocabulary has 2242 terms.

There is a pager at the bottom, but it does not work as expected.

If you go from page 1 to 2, you see the same terms. If you go to page 8, you see the end of the taxonomy (terms under Special), go to page 9 and you start with ARCS at the top of the list. Since ARCS is the first term, and Special > Transitory Information is the last, I would expect nothing after page 8.

I had this happen on dv14, test and dev. Prod isn't loading the page at all.

To reproduce

Steps to reproduce the behaviour:

  1. Go to '/admin/structure/taxonomy/manage/information_schedule/overview'
  2. Click on 'page 8'
  3. see that Special > Transitory Information is the last term
  4. click on page 9
  5. see that you start again with ARCS

This is just one example. Using the pager at all returns odd results no matter what you select.

Expected behaviour

    • [ ] The taxonomy overview pate loads
    • [ ] 200 items load then you need the pager to navigate. 200 is an arbitrary number. We are looking for a balance between performance and having as few pages as possible. We may need to adjust this.
    • [ ] The pager works as expected

[!NOTE]

Additional information

  • This problem only happens on the Drupal taxonomy page. If you use the contrib module taxonomy_manager there are no issues. /admin/structure/taxonomy_manager/voc/information_schedule
  • This vocabulary was imported using the import_taxonomy module
CraigClark commented 7 months ago

@lkmorlan when you get to this, let me know if you think it will take a lot of time. We can discuss with Nicole how important it is

lkmorlan commented 7 months ago

This is deliberate behaviour that has been in Drupal core since Drupal 6.0. The taxonomy term pagination always shows at least two root-level terms on each page. This allows dragging terms around to do whatever sorting is desired. This works fine if each root item doesn't have too many descendants. In our case, there are only a very few root terms and a huge number of total terms, so it doesn't work very well.

The relevant code is in core/modules/taxonomy/src/Form/OverviewTerms.php; search for "Keep a variable to make sure at least 2 root elements are displayed." This code was added for Drupal issue 193333 in commit e6a88be in 2007.

We could decide to use only taxonomy_manager, write something else, or patch core to remove this feature.

CraigClark commented 7 months ago

@lkmorlan I think we shouldn't fight against core unless there is a really good reason. In this case, I would consider a taxonomy like this to be edge case. I think we should document it, and in the documentation state that this taxonomy needs to be managed with taxonomy manager. I'm not that concerned about user impact since only the DC Admin has access to the taxonomies.

I'll add to the documentation and close this. Thanks for looking into it.

CraigClark commented 7 months ago

Assigning to myself to add documentation

CraigClark commented 7 months ago

Closing this. I have added an explanation to the docs see https://cat.data.fin.gov.bc.ca/documentation/information-schedule