Fix attempting to sync state in controlled Link Control #49506
Labels
[Feature] Link Editing
Link components (LinkControl, URLInput) and integrations (RichText link formatting)
[Type] Bug
An existing feature does not function as intended
In
packages/block-editor/src/components/link-control/use-internal-input-value.js
we are syncing internal state back up with any changes to the controlled value.gutenberg/packages/block-editor/src/components/link-control/use-internal-input-value.js
Lines 11 to 19 in a1f2679
The effect omits a dependency here of
internalInputValue
and reinstating it will cause a bug whereby you cannot modify the value of the inputs because they will be immediately synced back up with the controlledvalue
.I believe this code was added based on a bug whereby:
value
(for example when theLinkControl
component remains mounted by receives a new value)This was happening when you clicked around between Links on a RichText field. It was fixed by passing a unique
key
to each instance of the component so perhaps this fix is no longer needed.Alternatively we need a smarter way of going about this.
Originally discovered in #48722
The text was updated successfully, but these errors were encountered: