mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Make sure charts are destroyed.
This commit is contained in:
		| @@ -70,6 +70,9 @@ export default () => ({ | ||||
|         for (const i in data) { | ||||
|             if (data.hasOwnProperty(i)) { | ||||
|                 const current = data[i]; | ||||
|                 if (!current.hasOwnProperty('key')) { | ||||
|                     continue; | ||||
|                 } | ||||
|                 let key = current.key; | ||||
|                 // native (auto conversion): | ||||
|                 if (this.autoConversion) { | ||||
|   | ||||
| @@ -164,7 +164,7 @@ export default () => ({ | ||||
|             y: { | ||||
|                 ticks: { | ||||
|                     callback: function (context) { | ||||
|                         return formatMoney(context, currencies[0]); | ||||
|                         return formatMoney(context, currencies[0] ?? 'EUR'); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -25,6 +25,7 @@ import {Flow, SankeyController} from 'chartjs-chart-sankey'; | ||||
| import {loadTranslations} from "../../support/load-translations.js"; | ||||
| import {I18n} from "i18n-js"; | ||||
| import {getCacheKey} from "../../support/get-cache-key.js"; | ||||
| import {format} from "date-fns"; | ||||
|  | ||||
| Chart.register({SankeyController, Flow}); | ||||
|  | ||||
|   | ||||
| @@ -197,6 +197,9 @@ export default () => ({ | ||||
|             console.error('cannot handle yet'); | ||||
|             return; | ||||
|         } | ||||
|         // reset subscription data | ||||
|         subscriptionData = {}; | ||||
|         this.subscriptions = []; | ||||
|         console.log('cache is invalid, must download'); | ||||
|         let params = { | ||||
|             start: format(start, 'y-MM-dd'), | ||||
| @@ -263,6 +266,10 @@ export default () => ({ | ||||
|                 }, | ||||
|             } | ||||
|         }; | ||||
|         var graph = Chart.getChart(document.querySelector(id)); | ||||
|         if (typeof graph !== 'undefined') { | ||||
|             graph.destroy(); | ||||
|         } | ||||
|         new Chart(document.querySelector(id), config); | ||||
|     }, | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user