Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLInput: check suggestions enabled before update #18979

Merged
merged 3 commits into from
Dec 9, 2019
Merged

Conversation

mkaz
Copy link
Member

@mkaz mkaz commented Dec 6, 2019

Description

The URLInput has a diableSuggestions option, this changes prevents calling the function that checks for suggestions if it is disabled.

This prevents extra API calls and does not show the loader. Both of which should improve performance for entering URLs when suggestions are disabled.

Use case is in Social Links, see: #18946

How has this been tested?

  1. Add Social Link
  2. When typing URL, confirm loader does not show
  3. Add another link, for example in a Paragraph block, confirm suggestions/loader does show.

Types of changes

Adds a check for disableSuggestions and if set, does not trigger the updateSuggestions

The URLInput has a diableSuggestions option, this changes prevents
calling the function that checks for suggestions if it is disabled.

This prevents extra API calls and does not show the loader. Both of
which should improve performance for entering URLs when suggestions are
disabled.
@mkaz mkaz added the [Status] In Progress Tracking issues with work in progress label Dec 6, 2019
@mkaz
Copy link
Member Author

mkaz commented Dec 6, 2019

Thinking about this more, I think it needs to be refactored. The showSuggestions is a trigger for the UI to show the suggestion box not if it should show them or not.

So my change solved for one case but broke it showing for when it should showSuggestions after not finding a suggestion, because the function that updates that setting won't get called.

@mkaz mkaz removed the [Status] In Progress Tracking issues with work in progress label Dec 6, 2019
@mkaz
Copy link
Member Author

mkaz commented Dec 6, 2019

Fixed, switched to use this.props.disableSuggestions as the check. 👍

@mkaz mkaz merged commit e42fdd7 into master Dec 9, 2019
@mkaz mkaz deleted the fix/urlinput-loading branch December 9, 2019 17:28
@youknowriad youknowriad added this to the Gutenberg 7.2 milestone Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants