🐛 (editor) Flush code editor value when closing
This commit is contained in:
@ -5,7 +5,7 @@ import {
|
|||||||
useColorModeValue,
|
useColorModeValue,
|
||||||
useDisclosure,
|
useDisclosure,
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
import { useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { useDebouncedCallback } from 'use-debounce'
|
import { useDebouncedCallback } from 'use-debounce'
|
||||||
import { VariablesButton } from '@/features/variables'
|
import { VariablesButton } from '@/features/variables'
|
||||||
import { Variable } from 'models'
|
import { Variable } from 'models'
|
||||||
@ -70,6 +70,13 @@ export const CodeEditor = ({
|
|||||||
setCarretPosition(codeEditor.current?.state?.selection.main.head ?? 0)
|
setCarretPosition(codeEditor.current?.state?.selection.main.head ?? 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(
|
||||||
|
() => () => {
|
||||||
|
setValue.flush()
|
||||||
|
},
|
||||||
|
[setValue]
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HStack
|
<HStack
|
||||||
align="flex-end"
|
align="flex-end"
|
||||||
|
Reference in New Issue
Block a user