-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Terms: Include only known terms in rendered selector #5913
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed this change fixes the bug of showing an empty tag in the beginning and the code looks good 👍
Please can you explain what you mean by
With 2.5.0 the problem you appear to be referring to occurs when a tag or custom taxonomy contains a blank. e.g. "two words". The problem occurs when only one multi word tag is assigned to the post. I also noted that the request to fetch the 'missing' terms appears like this:
But the response only contains information for the last term.
This is a backwards compatibility issue. |
This is a backwards compatibility issue. |
Hi @bobbingwide thank you for your debugging and feedback,
What I tested that this PR solves is: After this PR the problem does not happen. |
@jorgefilipecosta. I can confirm that I got the same problem that you tested using three one word tags. And now I don't appear to be able to reproduce the problem that I thought I'd found. The chances are very high that I stumbled across the same problem and attributed it incorrectly. I first noted the problem with this taxonomy block, associated with content last updated 3 years ago. 4 multi word tags... but I had no explanation for the three word tag :-) |
Yes, this is one of the problems not directly related to the requests so we were able to separate the improvement as it was needed no matter what changes happen in the request logic. The request logic will need to suffer a refactoring because of the paginated requests (dealing with +100 tags) during this time we will try to check the other bugs in the request system. Thank you for your inputs. |
Nice find! It's likely it's only occasionally problematic because we fire requests both for a set of all terms, and those assigned to the post, and between the two, even with only one returned from "assigned to the post", most terms details are likely available for a majority of sites (except those with many tags). The solution is an easy one, instead of:
It should be:
I'll include a fix for this specific problem here. It highlights a DevEx concern over being an easy oversight, hopefully one which is more easily overcome with abstractions of the core data module planned to be introduced to these components. |
Separated `include` arguments is invalid, and would return only the last of the set of parameters requested for include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @aduth, thank you for including the fix to the requests already in this PR, I confirmed it works as expected. So the changes are still good to 👍
Just to confirm I was able to produce the problem with only 2 terms attached to my post. |
This pull request seeks to resolve an issue where posts with multiple non-hierarchical terms assigned will display empty term values in the term selector. Previously, we would render a term even if its name could not be determined (because it had not yet been fetched), resulting in an issue of conflicting
key
assignments, since thekey
is derived from the value, an empty string when not yet known.With these changes, we only include the term in the selector if it's known. Since we explicitly request terms assigned to the post, this should work well enough, though by default this request would only return 10 terms. Therefore, it is possible that a post with more than 10 terms assigned would not display all terms in the selector. With these changes, I have increased this to 100, though this is still not a perfect solution since more than 100 terms for a post is technically possible. A more thorough solution would paginate results as necessary.
Since this component needs to be refactored with consideration of data module improvements (related: #5826), I am inclined to defer this to a future improvement.
Testing instructions:
Verify that with multiple tags assigned to a post, no empty tags appear in tag selector.