Skip to content

Commit 2a14a5a

Browse files
committed
fix(chartjs.component): side chart animation issue, rollback to afterRenderEffect
1 parent 5604908 commit 2a14a5a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

projects/coreui-angular-chartjs/src/lib/chartjs.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
afterRenderEffect,
23
booleanAttribute,
34
ChangeDetectionStrategy,
45
ChangeDetectorRef,
@@ -160,10 +161,12 @@ export class ChartjsComponent implements OnDestroy {
160161
readonly ctx = computed(() => this.canvasElement()?.nativeElement.getContext('2d'));
161162

162163
constructor() {
163-
effect(() => {
164-
const ctx = this.ctx();
165-
if (ctx && !this.chart) {
166-
this.chartRender();
164+
afterRenderEffect({
165+
read: () => {
166+
const ctx = this.ctx();
167+
if (ctx && !this.chart) {
168+
this.chartRender();
169+
}
167170
}
168171
});
169172

0 commit comments

Comments
 (0)