How to change refresh-picker value from within my plugin?

For example: I want to make a button inside my panel, that changes the refresh-picker to ‘5s’.
I can see that RefreshPicker.tsx is extending PureComponent but I still don’t know how to use it…

Also: is it possible to change only one panel’s refresh rate?

If you’re referring to the refresh picker in the grafana/ui package, that’s only the UI control.

To update the refresh value itself, I think you could use the LocationSrv:

import { getLocationSrv } from '@grafana/runtime';
getLocationSrv().update({
  query: {
    'refresh': '5s',
  },
  partial: true,
  replace: true,
});

Thanks,
I’ve found this also in the docs recently but wasn’t 100% sure that this is the right way to do it.
It’s working fine.
Thank you :slight_smile:

1 Like