gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Tags and Category Metaboxes Are Slow To Display

Open TheJeffr0 opened this issue 8 years ago • 5 comments

In WordPress 5.0 Beta 4 in the Gutenberg editor, there is a small delay when expanding the Categories and Tags metaboxes. The Categories metabox has 20 categories and every time the box is expanded, there is a second or two delay before they're displayed. It appears as though the list is regenerated each time the box is expanded. This also happens with tags. While the delay is not lengthy, it's long enough that it's noticeable and annoying. In the Classic editor, the categories are displayed almost instantaneously.

To Reproduce Steps to reproduce the behavior:

  1. Add a new post with Gutenberg
  2. Click the arrow to expand the Categories metabox.
  3. Close the metabox.
  4. Open the metabox

Expected behavior Instantaneous display of categories and tags similar to how it works in the Classic editor.

  • OS: Windows 10
  • Browser Firefox
  • Version 63.0.1

TheJeffr0 avatar Nov 15 '18 17:11 TheJeffr0

Indeed I'm seeing the same thing: https://tinytake.s3.amazonaws.com/pulse/jcasabona/attachments/9246647/TinyTake15-11-2018-12-25-41.mp4

OS: Windows 10 Browser: Chrome Version: 70.0.3538.102 (Official Build) (64-bit)

jcasabona avatar Nov 15 '18 17:11 jcasabona

Every time you open the categories box, Gutenberg is querying the Rest API categories-load

To me, this is the reason, why you experience this problem. Same problem occurs also with the tag search.

websupporter avatar Nov 15 '18 17:11 websupporter

Related to #6723 Provide loading UX when UI is dependent on an API request

Soean avatar Nov 15 '18 17:11 Soean

Probably I am just not too deep into the related discussions, but why do you need to load the categories again, once you have them loaded?

The only advantage I would see is, if in the meantime new categories would have been created, but as your categorieslist (101, 201, 301,...) grow this comes with quite some downsides.

Edit: I would have expected the loading of the terms to be done via the state management, but it seems, it is not (yet): https://github.com/WordPress/gutenberg/blob/3caec34c7bf7730427855c2b50f780ff07e87924/packages/editor/src/components/post-taxonomies/hierarchical-term-selector.js#L190-L219 https://github.com/WordPress/gutenberg/blob/3caec34c7bf7730427855c2b50f780ff07e87924/packages/editor/src/components/post-taxonomies/flat-term-selector.js#L76-L92

websupporter avatar Nov 15 '18 18:11 websupporter

Edit: I would have expected the loading of the terms to be done via the state management, but it seems, it is not (yet):

The reasons are documented in #11643

In order to move away from reloading Categories and Tags on each request, we'll need to solve that linked issue first. Closing in favor of #11643

danielbachhuber avatar Nov 15 '18 22:11 danielbachhuber