fix: Text panel should re-render when panel mode is changed #14922

This commit is contained in:
Johannes Schill 2019-01-17 11:06:47 +01:00
parent 9c8dea062a
commit a3e13b333e

View File

@ -33,11 +33,19 @@ export class TextPanelCtrl extends PanelCtrl {
this.events.on('refresh', this.onRefresh.bind(this));
this.events.on('render', this.onRender.bind(this));
const renderWhenChanged = (scope: any) => {
const { panel } = scope.ctrl;
return [
panel.content,
panel.mode
].join();
};
$scope.$watch(
'ctrl.panel.content',
renderWhenChanged,
_.throttle(() => {
this.render();
}, 1000)
}, 1000, {trailing: true})
);
}