Skip to content

Commit

Permalink
Fix the serialization of the array in the ui-sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzmadom committed Dec 11, 2024
1 parent e54c82b commit 1b6b78d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"workerpool": "^9.1.1"
},
"devDependencies": {
"@datalens-tech/ui-sandbox-modules": "^0.32.0",
"@datalens-tech/ui-sandbox-modules": "^0.33.0",
"@gravity-ui/app-builder": "^0.13.0",
"@gravity-ui/components": "^3.12.5",
"@gravity-ui/date-components": "^2.11.0",
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/Widgets/Chart/components/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const Content = (props: ChartContentProps) => {
);
break;
}
case 'setPatams': {
case 'setParams': {
if (onChange) {
onChange(
{type: 'PARAMS_CHANGED', data: {params: args}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ function getChartProps(chart: unknown) {
return pick(chart, 'chartHeight', 'chartWidth', 'index');
}

function clearVmProp(prop: unknown) {
function clearVmProp(prop: unknown): unknown {
if (prop && typeof prop === 'object') {
if (Array.isArray(prop)) {
return prop.map(clearVmProp);
}

if ('angular' in prop) {
// It looks like it's Highcharts.Chart - preparing a minimum of attributes for the entity
return getChartProps(prop);
Expand Down Expand Up @@ -201,7 +205,10 @@ async function getUnwrappedFunction(args: {
if (wrappedFn.args) {
preparedUserArgs = Array.isArray(wrappedFn.args) ? wrappedFn.args : [wrappedFn.args];
}
const fnArgs = [...restArgs, ...preparedUserArgs].map((a) => clearVmProp(a));
let fnArgs: unknown[] = [...restArgs, ...preparedUserArgs];
if (entryType === 'graph_node') {
fnArgs = fnArgs.map((a) => clearVmProp(a));
}

// prepare function context
const fnContext = clearVmProp(this);
Expand Down

0 comments on commit 1b6b78d

Please sign in to comment.