WrappedDash instantiated on each call (vs DjangoDash once)
While attempting to add some cache logic to the callbacks to avoid recalculating the result (quite heavy figures), I noticed that a WrappedDash instance is created on each call of a callback (via the DjangoDash.form_dash_instance).
I instrument the function in the WrappedDash.callback_map to add the cache logic. But this means that, on each callback, it needs to reinstrument the newly created WrappedDash.
I was wondering how we could have the WrappedDash created at the same time as the DjangoDash and for the dynamic (ie per request) WrappedDash arguments (I think to the replacements attribute) if we could pass them in some other way when needed (for the augment_initial_layout) ==> this would make the WrappedDash stateless.
Apologies, managed to overlook this. For sure WrappedDash looks like it could be split along these lines, although I think you'd first have to check the use of anything in the kwargs argument to the constructor. One line of attack could be to move the processing that is not per-request out of WrappedDash and into the DjangoDash instance that instantiates it.