Skip to content

Commit 96690c0

Browse files
committed
Move "chart is already connected" check
1 parent 275b23e commit 96690c0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Chartjs/assets/dist/controller.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class default_1 extends Controller {
1111
this.chart = null;
1212
}
1313
connect() {
14+
if(Chart.getChart(this.element)) {
15+
// Chart is already connected
16+
return;
17+
}
1418
if (!isChartInitialized) {
1519
isChartInitialized = true;
1620
this.dispatchEvent('init', {
@@ -20,10 +24,6 @@ class default_1 extends Controller {
2024
if (!(this.element instanceof HTMLCanvasElement)) {
2125
throw new Error('Invalid element');
2226
}
23-
if(Chart.getChart(this.element)) {
24-
// Chart is already connected
25-
return;
26-
}
2727
const payload = this.viewValue;
2828
if (Array.isArray(payload.options) && 0 === payload.options.length) {
2929
payload.options = {};

0 commit comments

Comments
 (0)