Skip to content

Commit

Permalink
revert commenting
Browse files Browse the repository at this point in the history
  • Loading branch information
meneman committed Sep 4, 2023
1 parent 2904ee5 commit 017097f
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions packages/fieldSettings/FieldSettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ export function FieldSettingsView({ additionalToolSettings }: FieldSettingsViewP
return lastPathSegment
}, [selectedKey])

// const keyIsEditable = Boolean(selectedElementJsonSchema && selectedElementJsonSchema.type !== 'object')
// useEffect(() => {
// if (key === undefined) return
// setNewKey(key)
// }, [key])
const keyIsEditable = Boolean(selectedElementJsonSchema && selectedElementJsonSchema.type !== 'object')
useEffect(() => {
if (key === undefined) return
setNewKey(key)
}, [key])

// const toggleKeyEditor = useCallback(() => {
// setShowKeyEditor(!showKeyEditor)
// }, [showKeyEditor])
const toggleKeyEditor = useCallback(() => {
setShowKeyEditor(!showKeyEditor)
}, [showKeyEditor])

// const handleKeyChange = useCallback(() => {
// if (!selectedKey || selectedKey.length <= 0) return
// const [lastPathSegment, path] = splitLastPath(selectedKey)
// if (lastPathSegment === undefined) return
// dispatch(selectElement(undefined))
// dispatch(renameField({ path: selectedKey, newFieldName: newKey }))
// const newPath = filterNullOrUndef([path, newKey]).join('.')
// dispatch(selectElement(newPath))
// }, [newKey, selectedKey])
const handleKeyChange = useCallback(() => {
if (!selectedKey || selectedKey.length <= 0) return
const [lastPathSegment, path] = splitLastPath(selectedKey)
if (lastPathSegment === undefined) return
dispatch(selectElement(undefined))
dispatch(renameField({ path: selectedKey, newFieldName: newKey }))
const newPath = filterNullOrUndef([path, newKey]).join('.')
dispatch(selectElement(newPath))
}, [newKey, selectedKey])

return (
<>
Expand Down

0 comments on commit 017097f

Please sign in to comment.