-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Pre-publish panel: Do not show suggestions for tags and categories if there are none #69453
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
Conversation
… there are none Update the conditions that determine if the pre-publish panel should show suggestions to add categories or tags. - If there are no tags on the site, then don't show the suggestion. - If there are no categories other than the default on the site, then don't show the suggestion.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +92 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
packages/editor/src/components/post-publish-panel/maybe-category-panel.js
Outdated
Show resolved
Hide resolved
Flaky tests detected in 6c79412. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13693959952
|
packages/editor/src/components/post-publish-panel/maybe-tags-panel.js
Outdated
Show resolved
Hide resolved
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.
Thank you, @carolinan!
The update works as expected ✅
Hi @carolinan , If we are not showing the Categories and tags in the panel at all I guess we can also remove the |
@HILAYTRIVEDI, the
I don't think there will be any actual performance gain from this. The components are only rendered during publishing steps. |
Yes but @Mamaduka , it will only be visible if we want to let user add the categories and with this solution we are completely removing that from the side panel so this ( useEffect ) will not have any effect even if I remove it. Also , We can use |
Nothing is being removed completely; if a site has some categories, the panel will function as before. You can give it a try.
I wouldn't recommend adding memoization to everything. Memoizing that values vs not memoizing won't really change anything. Related reading: |
Thank you @Mamaduka for the reads on the performance optimisation techniques. I noticed this snippet in the repo: gutenberg/packages/block-editor/src/components/global-styles/filters-panel.js Lines 35 to 54 in 8b88ada
gutenberg/packages/block-editor/src/components/global-styles/filters-panel.js Lines 204 to 212 in 8b88ada
The Wrapper component with additional propsgutenberg/packages/block-editor/src/components/global-styles/filters-panel.js Lines 215 to 220 in 8b88ada
Similarly, the objects returned by function containing useMemo being used to get duotonePalette and colorPalettegutenberg/packages/block-editor/src/components/global-styles/filters-panel.js Lines 181 to 188 in 8b88ada
DuotonePicker component with additional propsgutenberg/packages/block-editor/src/components/global-styles/filters-panel.js Lines 241 to 249 in 8b88ada
Since both the Let me know what you think about this @Mamaduka |
@im3dabasia, I wouldn't start refactoring that component just to remove memoization. They're not broken, and removing or leaving them in won't have any measurable performance impact. It's just something to keep in mind for future work. P.S. IMO, currently, our resources are better spent on fixing actual bugs.
Unfortunately, there's no single rule when it comes to performance optimizations; it is just best practices and examples that need to be analyzed case by case. |
… there are none (WordPress#69453) * Pre-publish panel: Do not show suggestions for tags and categories if there are none Update the conditions that determine if the pre-publish panel should show suggestions to add categories or tags. - If there are no tags on the site, then don't show the suggestion. - If there are no categories other than the default category on the site, then don't show the suggestion. Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: HILAYTRIVEDI <hilayt24@git.wordpress.org> Co-authored-by: code-with-mehedi <mehedi_csit@git.wordpress.org>
What?
Closes #69452
Update the conditions that determine if the pre-publish panel should show suggestions to add categories or tags.
Why?
Testing Instructions
First, enable the pre-publish checks in the user preference.
There should be no regressions on sites where there are tags and extra categories:
Create a new draft post. Select "Publish".
The pre-publish panel should show suggestions to add categories and tags.
On sites where there are no tags or extra categories:
Create a new draft post. Select "Publish".
The pre-publish panel should not show suggestions to add categories and tags.
Screenshots or screencast
After, if there are no tags or extra categories on the site:
