2
0

fix(editor): 🐛 FIx Webhook settings debounce

This commit is contained in:
Baptiste Arnaud
2022-03-10 17:32:14 +01:00
parent 6cf89d8d9c
commit 31298e39c1
11 changed files with 50 additions and 15 deletions

View File

@ -10,14 +10,16 @@ import { useDebouncedCallback } from 'use-debounce'
type Props = {
value: string
lang?: 'css' | 'json' | 'js' | 'html'
onChange?: (value: string) => void
isReadOnly?: boolean
debounceTimeout?: number
onChange?: (value: string) => void
}
export const CodeEditor = ({
value,
lang,
onChange,
isReadOnly = false,
debounceTimeout = 1000,
...props
}: Props & Omit<BoxProps, 'onChange'>) => {
const editorContainer = useRef<HTMLDivElement | null>(null)
@ -28,7 +30,7 @@ export const CodeEditor = ({
setPlainTextValue(value)
onChange && onChange(value)
},
process.env.NEXT_PUBLIC_E2E_TEST ? 0 : 1000
process.env.NEXT_PUBLIC_E2E_TEST ? 0 : debounceTimeout
)
useEffect(