flatironinstitute / mcmc-monitor

Monitor MCMC runs in the browser
Other
36 stars 0 forks source link

Separate cache initialization from polling start/stop. #38

Closed jsoules closed 1 year ago

jsoules commented 1 year ago

Fix #17.

This PR separates the step of initializing the MCMCDataManager cache from the control for turning its polling off and on, which is now attached to the RunPage page/component directly so that the polling gets terminated in the cleanup step when we're on a page where it isn't relevant.

To do this, I've moved the cache object itself into the base App level and have the reference passed down a couple levels. It's not the greatest, but I didn't really want to set up yet another context object; however, it's possible this would be better managed by a custom hook. I played around with that for a bit but the underlying state wasn't updating properly, so I left it be and stuck with this solution, inelegant though it may be.

jsoules commented 1 year ago

To test:

magland commented 1 year ago

This seems like a good solution to me.