Page MenuHomePhabricator

search results page show instead of empty search page with a slow internet connection
Closed, ResolvedPublicBUG REPORT

Description

while testing for T252545 I found a weird issue with a slow internet connection:
1-open the search page
2-write 3 letters
3-delete 1 and wait for the result to change
4-delete 2
Expected result:
the search page should be empty
Actual result:
sometimes it shows the results of the search with the first letter

Event Timeline

Jpita created this task.May 24 2020, 5:11 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 24 2020, 5:11 AM
Jpita changed the subtype of this task from "Task" to "Bug Report".May 24 2020, 5:11 AM
hueitan added subscribers: SGautam_WMF, hueitan.EditedMay 25 2020, 11:55 AM

good catch @Jpita

In the useSearch.js, the promise chain is being called after set to null

useEffect(() => {
  if (query) {
    search(lang, query)
      .then(results => {
        setSearchResults(results) // (2) then here
      })
  } else {
    setSearchResults(null) // (1) execute first
  }
}, [lang, query])

Bring this diff back https://github.com/wikimedia/wikipedia-kaios/commit/07cb276176424485046fa5d0d47a32ce3fd399e2#diff-b524a695d310fdf2e9836b877efb19b2 will solve the problem.


To @SGautam_WMF, I think this is a good time for you to think about what should user have when the user empty the search bar, otherwise we will keep it on the first screen without any query result.

T244021: Possible calls to setState on unmounted components will solve this by making sure useEffect always abort the previous request before issuing a new one.

SBisson claimed this task.May 27 2020, 12:08 AM
SBisson edited projects, added Inuka-Team (Kanban); removed Inuka-Team.
SBisson moved this task from Backlog to QA on the Inuka-Team (Kanban) board.
SBisson triaged this task as Medium priority.May 27 2020, 12:10 AM
Jpita moved this task from QA to Design sign off on the Inuka-Team (Kanban) board.May 27 2020, 3:55 AM

sure @hueitan I will check with Angie as well.

SBisson moved this task from Backlog to Jio2 on the KaiOS-Wikipedia-app board.Jun 4 2020, 6:29 PM
SBisson edited projects, added KaiOS-Wikipedia-app (Jio2); removed KaiOS-Wikipedia-app.
AMuigai closed this task as Resolved.Jun 4 2020, 7:25 PM

Created a new ticket that we'll use when we're tackling performance issues. T254510.