continentaldivide / destiny-status

Player lookup tool for Destiny 2
https://destinystatus.net
0 stars 1 forks source link

"No results found" briefly flashes on initial user search #41

Closed continentaldivide closed 1 year ago

continentaldivide commented 1 year ago

Entering a search query flips this ternary condition at the bottom of SearchResultContainer to resolving true:

    <>
      {searchResults.length === 0 && username !== ''
        ? `no results found for ${username}`
        : searchResultComponents}
    </> 

It takes a split second after this for the useEffect watching username for changes to kick in and flip fetchingData to true, which bypasses the above ternary.

Not sure of the best direction to go with this one. Maybe changes in username and fetchingData need to be more closely coupled than they currently are rather than have a useEffect watching for changes in one to switch the other. Would username ever change without it entailing the user performing a new search?