nilsnolde / valhalla-app

This is the demo web app running on https://valhalla.openstreetmap.de
https://valhalla.openstreetmap.de
MIT License
170 stars 97 forks source link

FIX ASAP: when HTTP error, app crashes #183

Closed nilsnolde closed 1 year ago

nilsnolde commented 1 year ago

Description

Smth was introduced recently that crashes the app whenever there's a Valhalla error returned (i.e. HTTP status != 200), I suspect #174 . E.g. https://valhalla.openstreetmap.de/directions?profile=car&wps=8.564510099206025%2C54.6992335284814%2C7.154584538244154%2C54.881347024619686

Can you please take a look tmrw @Ananya2001-an ?

Screenshots

No response

Ananya2001-an commented 1 year ago

Sure I will see to it

Ananya2001-an commented 1 year ago

Actually the errors might be happening due to that permalink function or something like that. Since these are what I faced in my test server. If you notice when you load the page for first time here: https://valhalla.openstreetmap.de/ it doesn't add the path /directions?profile=bicycle to the URL automatically which happened earlier every time (since it's default active tab). Even when we get error like u said on reloading the page it crashes weirdly...don't worry I will see what's the issue since this has to be sorted out for PR deployments as well. 👍🏼

nilsnolde commented 1 year ago

yeah it crashes again on reloading because it's trying the same request again, which again fails. can't tell what it is, but it's happening in a componentDidUpdate() function (see console).

Ananya2001-an commented 1 year ago

I will see what's happening. Need to debug properly.....

Ananya2001-an commented 1 year ago

I have fixed the error. He actually was setting the toast message type like this toast.message.type(....) in src/Controls/index.jsx file(line 137) but it should be set like this: toast[ message.type ](...) instead since it's a function name that we are dynamically changing.

nilsnolde commented 1 year ago

Great thanks for the quick fix:)