neherlab / covid19_scenarios

Models of COVID-19 outbreak trajectories and hospital demand
https://covid19-scenarios.org
MIT License
1.36k stars 352 forks source link

True browser history #346

Closed dkozar closed 4 years ago

dkozar commented 4 years ago

🙋 Feature Request

History of the left panel (parameters)

Currently we're pushing to browser history only when user clicks the "Run" button:

window.history.pushState('', '', `?${queryString}`)

I'd expect that the URL gets updated each and every time the user touches the "Parameters" section.

Additionally, when the user uses "Back" browser button, the previous values in the form should be filled in. This means that "sliders" in the Mitigation sections should move to their previous positions:

image

History of the right panel (graphs)

I'd also expect that, if I use the browser Back button, the "previous graph" gets loaded.

Currently we're not executing the algorithm unless the user explicitly clicks the Run button. Is this because of performance concerns?

🔦 Context

It's something that users expect to see.

😯 Describe the feature

We should use React router and do all the changes in our app indirectly via the URL.

This means that, when the Run button is clicked, we would only update the URL (without calling the chart rendering). Then, the React Router would react on the URL change, deserialize the URL into the state and run the algorithm.

Related

thoo1 commented 4 years ago

going to take a shot at fixing this