-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Latest posts] Fixes the categories selector crash when category does not exist #20960
[Latest posts] Fixes the categories selector crash when category does not exist #20960
Conversation
Size Change: -291 B (0%) Total Size: 856 kB
ℹ️ View Unchanged
|
I notice #20961 also aims to solve this. @draganescu @Ringish Preference on which to keep? |
@aduth thanks! :) we know, in a weird sync we both published the PRs at the same time. Well decide which is better. |
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.
Worked for me, though I did find the code a little hard to follow. I wondered if an early return like this might be more preferable at the start of the selectCategories function. Then the mapping function wouldn't have to worry about returning null
:
const hasNoSuggestion = tokens.some(
( token ) => typeof token === 'string' && ! suggestions[ token ]
);
if ( hasNoSuggestion ) {
return;
}
Description
Closes #20915
How has this been tested?
Tested locally by:
Types of changes
Non breaking changes to the LatestPosts edit component.
cc @Ringish