leaflet-environmental-layers icon indicating copy to clipboard operation
leaflet-environmental-layers copied to clipboard

Stop displaying spinner if a layer fails to load for 10 seconds

Open jywarren opened this issue 6 years ago • 10 comments

We are getting occasional permanent spinners when layers don't respond, like in https://github.com/publiclab/leaflet-environmental-layers/issues/146 - and with so many sources, I think this can just happen from time to time. We should either make the spinner much smaller and put it in a corner, so it's not distracting, or we should have it disappear after 10 seconds.

Try it out here: https://publiclab.org/wiki/sandbox-3

We could separately decide to show a "didn't load" broken icon like https://fontawesome.com/v4.7.0/icon/exclamation-triangle next to the layer name!

@crisner maybe this is a feature you might consider in your plan? Thanks!!

Screen Shot 2019-12-03 at 10 06 44 AM

jywarren avatar Dec 03 '19 15:12 jywarren

I wanna work on this issue.

neelesh17 avatar Feb 19 '20 17:02 neelesh17

Great! Go ahead!

crisner avatar Feb 19 '20 17:02 crisner

Hey @crisner should i put the spinner on the top-left hand side corner.

neelesh17 avatar Feb 21 '20 06:02 neelesh17

You could do one of the two things mentioned below. Whichever you could accomplish. 😃

If the spinner is still running after 10 seconds

  • stop the spinner or
  • make it smaller and put it on the bottom-left corner.

crisner avatar Feb 21 '20 06:02 crisner

First one sounds good to me.

neelesh17 avatar Feb 21 '20 06:02 neelesh17

Great! 👍

crisner avatar Feb 21 '20 06:02 crisner

@crisner i added the code for some of the layers. Please review it.

neelesh17 avatar Feb 22 '20 06:02 neelesh17

@jywarren, there is an implementation in PR #417 where the spinner is stopped when the data fails. There were times it took really long to respond but I am not sure I am remembering it right as it doesn't happen now. My question is do we still add the feature to stop the spinner if it takes longer than 10 seconds? Also, do we add it in a successful data fetch as well? For example, fractracker mobile layer sometimes takes longer than 10secs to load the data. This has been tried in PR #414 .

crisner avatar Mar 02 '20 06:03 crisner

Yes, so sorry for replying slowly but I think this is a good idea. We could think about adding an X icon next to the layer if it breaks but the spinner in the middle of the map makes it hard to use those layers which did succeed, you know?

Thank you!

jywarren avatar May 07 '20 22:05 jywarren

Great! We've already implemented using '⚠️' icon from font awesome to display next to the layer when it breaks. 🥳 image

@neelesh17, would you like to continue working on your PR #414?

crisner avatar May 08 '20 02:05 crisner