File tree Expand file tree Collapse file tree 2 files changed +22
-18
lines changed
client/src/pages/platform/workflow-editor Expand file tree Collapse file tree 2 files changed +22
-18
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import {twMerge} from 'tailwind-merge';
3434import { useDebouncedCallback } from 'use-debounce' ;
3535
3636import useWorkflowEditorStore from '../../stores/useWorkflowEditorStore' ;
37+ import formatKeysWithDigits from '../../utils/formatKeysWithDigits' ;
3738import replaceSpacesInKeys from '../../utils/replaceSpacesInObjectKeys' ;
3839import ArrayProperty from './ArrayProperty' ;
3940import ObjectProperty from './ObjectProperty' ;
@@ -199,24 +200,6 @@ const Property = ({
199200 return componentDefinitions . find ( ( component ) => component . name === componentName ) ?. icon || '📄' ;
200201 } ;
201202
202- const formatKeysWithDigits = ( obj : any ) => {
203- const formattedObj = { ...obj } ;
204-
205- Object . keys ( formattedObj ) . forEach ( ( key ) => {
206- if ( key . match ( / ^ \d / ) ) {
207- formattedObj [ `${ PATH_DIGIT_PREFIX } ${ key } ` ] = formattedObj [ key ] ;
208-
209- delete formattedObj [ key ] ;
210- }
211-
212- if ( typeof formattedObj [ key ] === 'object' && formattedObj [ key ] !== null ) {
213- formattedObj [ key ] = formatKeysWithDigits ( formattedObj [ key ] ) ;
214- }
215- } ) ;
216-
217- return formattedObj ;
218- } ;
219-
220203 const saveInputValue = useDebouncedCallback ( ( ) => {
221204 if ( ! currentComponent || ! workflow || ! name || ! path || ! updateWorkflowNodeParameterMutation ) {
222205 return ;
Original file line number Diff line number Diff line change 1+ import { PATH_DIGIT_PREFIX } from '@/shared/constants' ;
2+ import isObject from 'isobject' ;
3+
4+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5+ export default function formatKeysWithDigits ( obj : any ) {
6+ const formattedObj = { ...obj } ;
7+
8+ Object . keys ( formattedObj ) . forEach ( ( key ) => {
9+ if ( key . match ( / ^ \d / ) ) {
10+ formattedObj [ `${ PATH_DIGIT_PREFIX } ${ key } ` ] = formattedObj [ key ] ;
11+
12+ delete formattedObj [ key ] ;
13+ }
14+
15+ if ( isObject ( formattedObj [ key ] ) && formattedObj [ key ] !== null ) {
16+ formattedObj [ key ] = formatKeysWithDigits ( formattedObj [ key ] ) ;
17+ }
18+ } ) ;
19+
20+ return formattedObj ;
21+ }
You can’t perform that action at this time.
0 commit comments