-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Labels
[Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)Link components (LinkControl, URLInput) and integrations (RichText link formatting)[Package] Block editor/packages/block-editor/packages/block-editor[Type] Code QualityIssues or PRs that relate to code qualityIssues or PRs that relate to code quality
Description
Currently URLInput
requires that, when called, __experimentalFetchLinkSuggestions
return a Promise
which resolves with the search suggestion results.
However, this causes some technical debt and inelegant code to be required by components that consume URLInput
. For example LinkControl
uses the __experimentalFetchLinkSuggestions
to provide results for direct URL entry. In doing so it is forced to return a Promise
even though the results themselves have no need of async fetching.
To solve this we should make the updateSuggestions
method of URLInput
handle values even if they are not Promises. This shoulld be as simple as wrapping the result of calling __experimentalFetchLinkSuggestions()
with Promise.resolve()
:
Promise.resolve(__experimentalFetchLinkSuggestions).then()
Metadata
Metadata
Assignees
Labels
[Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)Link components (LinkControl, URLInput) and integrations (RichText link formatting)[Package] Block editor/packages/block-editor/packages/block-editor[Type] Code QualityIssues or PRs that relate to code qualityIssues or PRs that relate to code quality