Page MenuHomePhabricator portal search broken (no results, fetches from
Closed, ResolvedPublic


  1. in latest Chrome on macOS
  2. Typing in the search field


  • No results.
  • Network inspection shows it is trying to fetch from

Code versions:

"GeoIP=GB:ENG:London:*:*:v4; CP=H2"
Local Storage
(length: 4)

lang-list-active: "false"
portal_session_id: "*"
portal_test_group_expires: "1503439955049"
translationHash: "b63ef08f"
Session Storage
(length: 0)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle triaged this task as Unbreak Now! priority.Aug 22 2017, 10:01 PM

This bug consistently happens in all browsers, including other language settings. After typing more characters, however, the results do work.

I traced the problem to a logic error in typehead.js at

The searchLang variable is initially declared undefined, and remains so until the first call to the typeahead function loadQueryScript(). This function creates a url to the API endpoint and makes the fetch, and this url embeds the value of searchLang. The variable searchLang, however, is not updated/declared until after the function defines the URL.

As such, the API url is always one step behind regarding value changes to searchLang , and this means initially it will try to fetch from

Krinkle lowered the priority of this task from Unbreak Now! to High.Aug 22 2017, 10:50 PM

Change 373360 had a related patch set uploaded (by Jdrewniak; owner: Jdrewniak):
[wikimedia/portals@master] Fix typeahead on first character

debt lowered the priority of this task from High to Medium.Aug 24 2017, 4:08 PM
debt added a project: Discovery-Portal-Sprint.
debt moved this task from Backlog to Needs code review on the Discovery-Portal-Sprint board.

Change 373360 merged by jenkins-bot:
[wikimedia/portals@master] Fix typeahead on first character

debt added a subscriber: debt.

This was pushed to production on Sep 6, 2017

wikipedia-portal_auto-typeahead_fixed.png (697×571 px, 135 KB)

debt assigned this task to Jdrewniak.