Search Block: Button Only style creates unnecessary undo history #53174
Labels
[Block] Search
Affects the Search Block - used to display a search field
[Feature] Block Validation/Deprecation
Handling block validation to determine accuracy and deprecation
[Feature] History
History, undo, redo, revisions, autosave.
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
When a search block is "Button only" style, clicking on the block will create an unnecessary undo history. This is because the attribute
isSearchFieldHidden
is updated viauseEffect
whenisSelected
prop is changed:gutenberg/packages/block-library/src/search/edit.js
Lines 146 to 163 in 5f30ade
This attribute is referenced only by the Edit component and appears to be used only to control the class name. In such cases, attributes should not be used and should be able to be determined by a combination of state or existing props.
Screenshots, screen recording, code snippet
8abf14b35da11f232f341dcbfd1978b9.mp4
The text was updated successfully, but these errors were encountered: