From bad7a535dcc2ff74a3e43ce6d4df46cb7eebdcd5 Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Tue, 14 May 2024 09:24:18 +0100 Subject: [PATCH] add clonedeep that copies non-serialisable stuff --- .../components/app/charts/ApexChart.svelte | 5 ++- .../components/app/charts/AreaChart.svelte | 2 +- .../src/components/app/charts/BarChart.svelte | 2 +- .../app/charts/CandleStickChart.svelte | 2 +- .../components/app/charts/DonutChart.svelte | 2 +- .../components/app/charts/LineChart.svelte | 2 +- .../src/components/app/charts/PieChart.svelte | 2 +- .../src/components/app/charts/formatters.js | 8 ---- .../client/src/components/app/charts/utils.js | 40 +++++++++++++++++++ .../src/components/app/charts/utils.test.js | 33 +++++++++++++++ 10 files changed, 82 insertions(+), 16 deletions(-) delete mode 100644 packages/client/src/components/app/charts/formatters.js create mode 100644 packages/client/src/components/app/charts/utils.js create mode 100644 packages/client/src/components/app/charts/utils.test.js diff --git a/packages/client/src/components/app/charts/ApexChart.svelte b/packages/client/src/components/app/charts/ApexChart.svelte index 8cbdbd0cca..1fd3cffdce 100644 --- a/packages/client/src/components/app/charts/ApexChart.svelte +++ b/packages/client/src/components/app/charts/ApexChart.svelte @@ -2,7 +2,7 @@ import { getContext } from "svelte" import ApexCharts from "apexcharts" import { Icon } from "@budibase/bbui" - import { cloneDeep } from "lodash" + import { cloneDeep } from "./utils" const { styleable, builderStore } = getContext("sdk") const component = getContext("component") @@ -10,7 +10,8 @@ export let options // Apex charts directly modifies the options object with default properties and internal variables. These being present could unintentionally cause issues to the provider of this prop as the changes are reflected in that component as well. To prevent any issues we clone options here to provide a buffer. - $: optionsCopy = structuredClone(options) + $: optionsCopy = cloneDeep(options) + $: console.log(options, optionsCopy) let chartElement let chart diff --git a/packages/client/src/components/app/charts/AreaChart.svelte b/packages/client/src/components/app/charts/AreaChart.svelte index d30365e4d0..626f2e041a 100644 --- a/packages/client/src/components/app/charts/AreaChart.svelte +++ b/packages/client/src/components/app/charts/AreaChart.svelte @@ -1,6 +1,6 @@