Skip to content

Commit

Permalink
Remove effect dep in Link Control (#53421)
Browse files Browse the repository at this point in the history
* Use functional setstate to avoid dep

* Remove check entirely
  • Loading branch information
getdave authored Aug 8, 2023
1 parent 812a384 commit b23b645
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,11 @@ function LinkControl( {
useCreatePage( createSuggestion );

useEffect( () => {
if (
forceIsEditingLink !== undefined &&
forceIsEditingLink !== isEditingLink
) {
setIsEditingLink( forceIsEditingLink );
if ( forceIsEditingLink === undefined ) {
return;
}
// Todo: bug if the missing dep is introduced. Will need a fix.
// eslint-disable-next-line react-hooks/exhaustive-deps

setIsEditingLink( forceIsEditingLink );
}, [ forceIsEditingLink ] );

useEffect( () => {
Expand Down

0 comments on commit b23b645

Please sign in to comment.