Skip to content

Commit

Permalink
Merge pull request #21948 from Yoast/21926-bug-with-links-added-to-th…
Browse files Browse the repository at this point in the history
…e-gutenberg-native-table-block

Remove cache around changing link
  • Loading branch information
pls78 authored Jan 7, 2025
2 parents 8f2e3ad + 4c58c5d commit ae2273b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/js/src/inline-links/inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PropTypes from "prop-types";
/**
* WordPress dependencies
*/
import { useMemo, useState, useCallback } from "@wordpress/element";
import { useMemo, useState } from "@wordpress/element";
import { __, sprintf } from "@wordpress/i18n";
import { withSpokenMessages, Popover } from "@wordpress/components";
import { prependHTTP } from "@wordpress/url";
Expand Down Expand Up @@ -190,7 +190,12 @@ function InlineLinkUI( {
}
};

const onChangeLink = useCallback( ( nextValue ) =>{
/**
* Handles the change of the link.
* @param {Object} nextValue The next link URL.
* @returns {void}
*/
const onChangeLink = ( nextValue ) => {
/*
* Merge with values from state, both for the purpose of assigning the next state value, and for use in constructing the new link format if
* the link is ready to be applied.
Expand Down Expand Up @@ -256,7 +261,7 @@ function InlineLinkUI( {
}

actionCompleteMessage( newUrl );
}, [] );
};

const NoFollowHelpLink = <HelpLink
href={ window.wpseoAdminL10n[ "shortlinks.nofollow_sponsored" ] }
Expand Down Expand Up @@ -333,6 +338,7 @@ function InlineLinkUI( {
>
<LinkControl
value={ linkValue }
// eslint-disable-next-line react/jsx-no-bind
onChange={ onChangeLink }
forceIsEditingLink={ addingLink }
settings={ settings }
Expand Down

0 comments on commit ae2273b

Please sign in to comment.