I have a similar question to Javascript/jQuery event on regular refresh intervals?. That was about how to “catch” a refresh event from a JavaScript snippet in an HTML panel. I would like to kind of do the opposite - i.e. I’d like to set the dashboard auto-refresh interval to a particular value from a similar script.
While the value was set successfully, it did not have any effect on the actual dashboard behavior.
I suspect that the above is no longer a viable approach in 7.x, with the migration to React? Is there still a reasonable way to achieve what I’m attempting?
Tough question - I will ask the frontend experts in the team for a better answer as your approach is using Grafana internals that are subject to change in the future.
Did you test using the setAutoRefresh function in the TimeSrv class instead? There is also a refreshDashboard() function to manually trigger a refresh.