Open CSchoel opened 5 years ago
Cancelation a fetch call to the backend isn't that easy :thinking: . In fact i don't know any solution except:
just ignore the result once the promise is completed.
We need some kind of interceptor, that is executed before the next callback is called. We can't cancel an already running callback. Seva Zaikov wrote an article about it, though i don't like his approach. Bluebird's Promise implementation seems to support cancelation.
Either way I added a button for cancelation to the overlay, that does nothing at the moment :laughing:
Another rather dump (but working :thinking: ) implementation would be, to just reload the page when the user clicks the cancel button. If we don't save the loading state into local storage (see #124) all callbacks associated with backend requests should be aborted.
Don't know if this works in every case, but if we provide a confirmation dialog that cancelation is dangerous, this would be a solution.
Reopening, because this is not fixed by adding a cancellation button with a scary warning message. We need the following changes:
After trying some simulations and accidentally staring some with two separate values for startTime (due to #106 ), I get the overlay with "simulating, be patient" that does not disappear. There is no way to cancel the simulation and it does not finish. Maybe the simulation engine has crashed?