1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-17 21:49:20 +01:00

Drop a leftover useRef() call (#5510)

* Drop a leftover `useRef()` call

It was first introduced in #4819
but then the usage of this ref was removed with #4874

So the ref remained unused since then.

* Add a changeset
This commit is contained in:
Ivan Voskoboinyk 2023-09-18 20:32:55 +03:00 committed by GitHub
parent 70166d6386
commit 13c7d271e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
'slate-react': patch
---
Remove an unused React ref

View File

@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useRef, useState } from 'react'
import React, { useCallback, useEffect, useState } from 'react'
import { Descendant, Editor, Node, Scrubber } from 'slate'
import { FocusedContext } from '../hooks/use-focused'
import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'
@ -24,7 +24,6 @@ export const Slate = (props: {
onChange?: (value: Descendant[]) => void
}) => {
const { editor, children, onChange, initialValue, ...rest } = props
const unmountRef = useRef(false)
const [context, setContext] = React.useState<SlateContextValue>(() => {
if (!Node.isNodeList(initialValue)) {
@ -66,7 +65,6 @@ export const Slate = (props: {
return () => {
EDITOR_TO_ON_CHANGE.set(editor, () => {})
unmountRef.current = true
}
}, [editor, onContextChange])