data-skeptic / home-data-gallery

A place for people to send pull requests for interesting examples they'd like to share
11 stars 8 forks source link

Create "no results" React component #33

Open kylepolich opened 8 years ago

kylepolich commented 8 years ago

If there are no results, an error message shows up (see image)

http://imgur.com/9nHtRFm

This message can be shown erroneously in certain circumstances. Here are the steps to reproduce:

1) Move the map viewport to a small area that has listings you have not seen before 2) Notice that the client side checks localStorage and doesn't find any listings, so it puts up this error 3) Notice that the client is calling the API, and shows the spinning box image to let you know 4) Wait for API to respond with valid listings, and observe the error goes away

What should happen instead is you get a sort of "yellow" error, instead of a "red" error. We can't say with certainty there aren't any listings to show. You can say there aren't any in the cache, but you have to wait for the API.

Please make the error message have 3 states:

No error - hide the div

Waiting - show a waiting message if localStorage has nothing but API has not yet returned

No results - show the current message if the API comes back with nothing