Skip to content

Commit 9a77314

Browse files
committed
Make redrawAll resilient against errors in beforeRedrawAll
1 parent bfa70eb commit 9a77314

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/chart-group.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,15 @@ export class ChartGroup implements IChartGroup {
175175
* needs to be called to see the updated data.
176176
*/
177177
public async redrawAll(): Promise<void> {
178-
if (typeof this.beforeRedrawAll === 'function') {
179-
await this.beforeRedrawAll();
178+
try {
179+
if (typeof this.beforeRedrawAll === 'function') {
180+
await this.beforeRedrawAll();
181+
}
182+
} catch (e) {
183+
console.error(
184+
`The beforeRedrawAll callback faced an error: ${e}. Skipping redraw.`
185+
);
186+
return;
180187
}
181188

182189
for (const chart of this._charts) {

0 commit comments

Comments
 (0)