Set dates on DatePickerRange in callback without circular dependence

I have a plotly graph of a time series and I have a DatePickerRange. I use the date picker to set the desired range to display in the graph thanks to Jimmy Bow’s mydcc module. And I can also shift/zoom the graph by using its modebar buttons. What I would like in that case is to update the date picker’s displayed dates to reflect this new range. But I end up with a circular dependence because then I must change start_date and end_date and these will fire the callback that changes the desired range again and so on and on. Is there no way to only change the displayed text on the date picker and thus not firing the callback?

Hi @Anneke, welcome to the forum! You can store the existing range of date values (as a tuple for example) in a dcc.Store, and inside the callback updating the graph from the data picker, check whether the new values are close enough to the one of the dcc.Store, in which case you can return a dash.no_update to break the circular dependence.