Commit fedfbaa
committed
[FIX] Charts: Ensure Chart js extension are loaded on chart creation
When calling the method chartToImage, the chartJs extensions might not
be loaded as we load them conditionally when mounting a chart. Hence,
calling `ChartToImage` when there are no visible charts in the viewport
or if we just instantiate a model without loading a component
`Spreadsheet`, the extensions will be missing.
Right now, the plugins/extensions are not fundamental to convert a chart
to an image but this becomes problematic with the arrival of future
charts (for instance Funnel).
This commit adds a check to ensure that the extensisons are loaded and
unloads them after use as they can cause crashes when using the global
`ChartJs` variable elsewhere (see
#6076).
closes #7378
Task: 5214007
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>1 parent 2e9a842 commit fedfbaa
1 file changed
+17
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
2 | 7 | | |
3 | 8 | | |
4 | 9 | | |
| |||
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| 47 | + | |
42 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
46 | | - | |
| 56 | + | |
47 | 57 | | |
48 | 58 | | |
49 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
53 | | - | |
| 65 | + | |
54 | 66 | | |
55 | | - | |
56 | 67 | | |
57 | 68 | | |
58 | | - | |
| 69 | + | |
59 | 70 | | |
60 | | - | |
61 | 71 | | |
62 | | - | |
| 72 | + | |
63 | 73 | | |
64 | 74 | | |
65 | 75 | | |
| |||
0 commit comments