Changed the UNSAFE_ComponentWillUpdate lifecycle which was ran on every change to see if the sliders values had changed to send a new request, made the component call a debounced fetch function on change instead.
As for the sliders they make request only on the mouseUp event (user let go of the slider).
📄 Note to reviewers
I encounted two bugs (unrelated to the task) while working on this component.
The max value of the range is set to 120
which gives error code 151 when calling Valhalla's API (Exceeded max time 100) so I'm guessing the max value has to change to 100 here
Some requests return 504 which shows the user this messege
which is unhelpful IMO
I'm also dissatisfied with how async calls are done within this component, given unfortuante enough cirumstances a race condition like this can happen
but I think that have to wait until the components are rewritten into functional components
🛠️ Fixes Issue
Debounce Isochrone API calls #121
👨💻 Changes proposed
Changed the UNSAFE_ComponentWillUpdate lifecycle which was ran on every change to see if the sliders values had changed to send a new request, made the component call a debounced fetch function on change instead. As for the sliders they make request only on the mouseUp event (user let go of the slider).
📄 Note to reviewers
I encounted two bugs (unrelated to the task) while working on this component.
The max value of the range is set to 120 which gives error code 151 when calling Valhalla's API (Exceeded max time 100) so I'm guessing the max value has to change to 100 here
Some requests return 504 which shows the user this messege which is unhelpful IMO
I'm also dissatisfied with how async calls are done within this component, given unfortuante enough cirumstances a race condition like this can happen
but I think that have to wait until the components are rewritten into functional components
Also please consider this a pre-gsoc pr