[Feature Request] Allow circular (infinite!) callbacks
Hi, I have a feature request: allow circular callbacks causing an infinite loop.
Dash is going out of its way to detect and reject circular callback cycles (or allow cycle of 1 callback, but such that it gets prunned and still does not cause infinite loop) - which is what most users would want, but I have the exact opposite usecase.
You could argue my use-case is a little hack-ish, but I've found it to be a great way to build truly real-time apps in Dash. Basically my real-time data is made available on clientside via some other means (say, websocket), outside of Dash renderer. I then want to extend a chart with that data as soon as it's available. Now that Dash clientside callbacks support promises, what I could do (if infinite loop was allowed) was just to have a clientside callback that creates a promise, which I'd resolve with my data (either immediately or later, whenever data becomes available). As soon as that promise is resolved and chart is updated, I need a new promise (so I could feed new data to it) and so on. I'd like the same callback to trigger in a circular infinite fashion.
I understand this is contrary to all the effort of preventing infinite callback chains so far - but why not allow it with an option? In my case I only need a single callback firing infinitely (I do not need chains of multiple callbacks).
Is there any workaround / hack I could use to bypass the pruning perfomed in #1525?
As a workaround, you could try the cyclebreaker transform,
https://www.dash-extensions.com/pages/transforms/cycle-breaker-transform
@emilhe Thanks! I don't need the transform itself, but the CycleBreaker component is exactly the workaround I've been looking for! Was previously using react-trigger-change to fire a change event on an input, but this is now much cleaner with CycleBreaker.
Separately, would probably still be nice to have an official opt-in flag to allow infinite loops.