Skip to content

Commit b68bff8

Browse files
committed
Overwrite initialize instead of connect method since it is only called once
1 parent ac5145f commit b68bff8

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

src/Chartjs/assets/dist/controller.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default class extends Controller {
55
view: ObjectConstructor;
66
};
77
private chart;
8-
connect(): void;
8+
initialize(): void;
99
viewValueChanged(): void;
1010
private dispatchEvent;
1111
}

src/Chartjs/assets/dist/controller.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ class default_1 extends Controller {
1010
super(...arguments);
1111
this.chart = null;
1212
}
13-
connect() {
14-
if (this.element instanceof HTMLCanvasElement && Chart.getChart(this.element)) {
15-
return;
16-
}
13+
initialize() {
1714
if (!isChartInitialized) {
1815
isChartInitialized = true;
1916
this.dispatchEvent('init', {

src/Chartjs/assets/src/controller.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@ export default class extends Controller {
2626

2727
private chart: Chart | null = null;
2828

29-
connect() {
30-
if (this.element instanceof HTMLCanvasElement && Chart.getChart(this.element)) {
31-
// Chart is already connected
32-
return;
33-
}
34-
29+
initialize() {
3530
if (!isChartInitialized) {
3631
isChartInitialized = true;
3732
this.dispatchEvent('init', {

0 commit comments

Comments
 (0)