Skip to content

Commit

Permalink
Only get suggestions once when the input field is initially focused (#…
Browse files Browse the repository at this point in the history
…175)

Right now the suggestions are loaded whenever the field is empty
and it gets the focus. That's not needed, because old results are
retained anyway, thus we only ever need to get the suggestions
once. (If it gets refocused it displays the old suggestions again.)

This will save us quite some API requests and also will it save us
from race conditions when two such api requests are returning.

https://phabricator.wikimedia.org/T143645
  • Loading branch information
mariushoch authored and thiemowmde committed Aug 31, 2016
1 parent 888bdf8 commit 2d77cde
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
vendor/
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -45,6 +45,9 @@ generate this data from a wikidata dump.

## Release notes

### 3.1.3 (dev)
* Only get suggestions once when the property input field is initially focused.

### 3.1.2 (2016-08-04)
* Follow up fix for entity suggester, update cache management in EntitySuggester.

Expand Down
5 changes: 4 additions & 1 deletion modules/ext.PropertySuggester.EntitySelector.js
Expand Up @@ -42,7 +42,10 @@
}
};

this.element.on( 'focus', focusHandler );
// Search for suggestions once the field is initially focused.
// We only need to do this once, afterwards the old suggestions
// will re-appear on focus anyway.
this.element.one( 'focus', focusHandler );
},

/**
Expand Down

0 comments on commit 2d77cde

Please sign in to comment.