diff --git a/packages/devextreme/js/__internal/grids/new/grid_core/options_controller/options_controller_base.ts b/packages/devextreme/js/__internal/grids/new/grid_core/options_controller/options_controller_base.ts index 0bf2649f6741..c4ef8bd01e0e 100644 --- a/packages/devextreme/js/__internal/grids/new/grid_core/options_controller/options_controller_base.ts +++ b/packages/devextreme/js/__internal/grids/new/grid_core/options_controller/options_controller_base.ts @@ -8,6 +8,8 @@ import type { SubsGets, SubsGetsUpd, } from '@ts/core/reactive/index'; import { computed, state } from '@ts/core/reactive/index'; +import { extend } from '@ts/core/utils/m_extend'; +import { isPlainObject } from '@ts/core/utils/m_type'; import type { ComponentType } from 'inferno'; import { TemplateWrapper } from '../inferno_wrappers/template_wrapper'; @@ -58,13 +60,19 @@ function updateImmutable | unknown[]>( const [pathPart, ...restPathParts] = pathParts; const ret = cloneObjectValue(value); + // eslint-disable-next-line no-nested-ternary ret[pathPart] = restPathParts.length ? updateImmutable(value[pathPart], newValue[pathPart], restPathParts) - : newValue[pathPart]; + : isPlainObject(newValue[pathPart]) + ? extend(true, {}, newValue[pathPart]) + : newValue[pathPart]; return ret; } +// @ts-expect-error +window.updateImmutable = updateImmutable; + function getValue(obj: unknown, path: string): T { let v: any = obj; for (const pathPart of getPathParts(path)) {