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?
Entering a search query flips this ternary condition at the bottom of
SearchResultContainer
to resolving true:It takes a split second after this for the useEffect watching
username
for changes to kick in and flipfetchingData
to true, which bypasses the above ternary.Not sure of the best direction to go with this one. Maybe changes in
username
andfetchingData
need to be more closely coupled than they currently are rather than have a useEffect watching for changes in one to switch the other. Wouldusername
ever change without it entailing the user performing a new search?