Skip to content

Commit d84aeb0

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

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
@@ -28,12 +28,7 @@ export default class extends Controller {
2828

2929
private chart: Chart | null = null;
3030

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

0 commit comments

Comments
 (0)