Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildTermsTree returns only 1 result #20430

Closed
Chrico opened this issue Feb 25, 2020 · 5 comments
Closed

buildTermsTree returns only 1 result #20430

Chrico opened this issue Feb 25, 2020 · 5 comments
Labels
Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@Chrico
Copy link
Contributor

Chrico commented Feb 25, 2020

Describe the bug
We're using a CPT which is hierarchical.

In Gutenberg the "Select Parent" only shows 1 item, but we have 198 results splitted up into 2 requests for this select:

image

When debugging the component i'm seeing, that the buildTermsTree just returns an array with 1 result:

image

  • a = result from those 2 splitted up requests
  • s = the result from buildTermsTree

As far as i could debug, the error occurs in the recursive function fillWithChildren, after applying this on the terms, the array will shrink to 1.

Additional context

  • Gutenberg: 7.5
  • WordPress: 5.3.2

This seems also to be related to #12795 - maybe it is time to avoid rendering such "large" things and adding a select with autocomplete search functionality like e.G. https://react-select.com/home does.

@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended Needs Testing Needs further testing to be confirmed. labels Feb 28, 2020
@Chrico
Copy link
Contributor Author

Chrico commented Mar 25, 2020

Is there any feedback regarding this? I guess it's not reproduceable, but is there any plan to provide a new SelectControl which behaves more like an autocomplete and searches for typing?

It could occure, that there are a lot of Pages/CPT Posts which need to be rendered. So instead doing multiple requests and splitting up, you can just show the "current selected" and search on staring typing.

@bobbingwide
Copy link
Contributor

@Chrico We experienced this problem today in a site with just over 140 pages.
We noticed that the menu_order for each page was 0.
Changing just one value to a non-zero value seemed to help.
We chose to set the Front page's menu order to -1.
This meant it was first in the list so would be returned in the first REST request.

In my opinion the orderby on the query should include post_parent and name/title

@noisysocks
Copy link
Member

Hi @Chrico. Could you please provide some steps to follow which demonstrates the problem? I'm not sure how to test it otherwise.

@Chrico
Copy link
Contributor Author

Chrico commented Nov 24, 2020

Good morning @noisysocks . Steps are kind of listed in initial issue description: You need a CPT which is hierarchical and >100 Posts in it with "menu_order = 0" (default). When you try to select the "menu_order" it renders not correctly.

But in 9 month since i created the issue, a lot has changed...need to re-test, probably even the shown code does not exists anymore like it was before.

@talldan talldan added [Status] Needs More Info Follow-up required in order to be actionable. Needs Testing Needs further testing to be confirmed. and removed Needs Testing Needs further testing to be confirmed. [Status] Needs More Info Follow-up required in order to be actionable. labels Apr 13, 2021
@annezazu
Copy link
Contributor

@Chrico checking back in on this and am going to close this out for now. Know that we can easily re-open if upon retesting you can re-confirm the issue. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants