slate
slate copied to clipboard
use with mobx-react-lite error
Description
import { observer } from 'mobx-react-lite'
const App = observer(() => {
return (
<Slate.... />
)
})
The initial rendering is correct, but an error occurs when inputting
Error: Cannot resolve a DOM point from Slate point: {"path":[0,0],"offset":1}
Recording
If any parent component has an observer, there will be problems. If you remove the observer, there will be no problem.
After wrapping the editing component with a separate layer of memo, does it look normal again? I suspect that the refresh of the parent component will cause the slate exception.
import { observer } from 'mobx-react-lite'
import { memo } from 'react'
const App = observer(() => {
return (
<Main />
)
})
const Main = memo(function T () {
return <Slate.... />
})