Skip to content

Commit 911d962

Browse files
committed
Apply review suggestions and add an entry to the CHANGELOG file
1 parent e08eac4 commit 911d962

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/Chartjs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.23.0
4+
5+
- Listen to Stimulus `disconnect` event to destroy the chart #1944
6+
37
## 2.18.0
48

59
- Replace `chartjs/auto` import with explicit `Chart.register()` call #1263

src/Chartjs/assets/dist/controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class default_1 extends Controller {
3636
this.dispatchEvent('connect', { chart: this.chart });
3737
}
3838
disconnect() {
39+
this.dispatchEvent('disconnect', { chart: this.chart });
3940
if (this.chart) {
4041
this.chart.destroy();
4142
this.chart = null;
4243
}
43-
this.dispatchEvent('disconnect', { chart: this.chart });
4444
}
4545
viewValueChanged() {
4646
if (this.chart) {

src/Chartjs/assets/src/controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ export default class extends Controller {
5858
}
5959

6060
disconnect() {
61+
this.dispatchEvent('disconnect', { chart: this.chart });
62+
6163
if (this.chart) {
6264
this.chart.destroy();
6365
this.chart = null;
6466
}
65-
66-
this.dispatchEvent('disconnect', { chart: this.chart });
6767
}
6868

6969
/**

0 commit comments

Comments
 (0)