Small optimization for Heading levels block transform and to - from Paragraph block transform #60949
Labels
[Package] Block library
/packages/block-library
[Status] In Progress
Tracking issues with work in progress
[Type] Enhancement
A suggestion for improvement.
Description
After #60606 the code responsible for transforming heading levels and to - from paragraph is centralised in a unique place. This makes easier to add a small optimization and avoid to run a block transform when not necessary.
When using the keybaord shortcuts to change heading levels or transform to - from paragraph, there is no check whether the heading already has the destination level or whether the block is already a paragraph or heading.
That is, for example:
Running code to transform a block to the same block type / level is unnecessary and should be avoided.
The performance optimization would be minimal but still nice.
Visually, this would would reduce some 'flickering' in the settings panel. That's triggered for any block transform but it should be avoided when the transform is not necessary. See attached GIF thtat illustrates the 'flickering'.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: