1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-12 10:14:02 +02: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
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 { Descendant, Editor, Node, Scrubber } from 'slate'
import { FocusedContext } from '../hooks/use-focused' import { FocusedContext } from '../hooks/use-focused'
import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect' import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'
@@ -24,7 +24,6 @@ export const Slate = (props: {
onChange?: (value: Descendant[]) => void onChange?: (value: Descendant[]) => void
}) => { }) => {
const { editor, children, onChange, initialValue, ...rest } = props const { editor, children, onChange, initialValue, ...rest } = props
const unmountRef = useRef(false)
const [context, setContext] = React.useState<SlateContextValue>(() => { const [context, setContext] = React.useState<SlateContextValue>(() => {
if (!Node.isNodeList(initialValue)) { if (!Node.isNodeList(initialValue)) {
@@ -66,7 +65,6 @@ export const Slate = (props: {
return () => { return () => {
EDITOR_TO_ON_CHANGE.set(editor, () => {}) EDITOR_TO_ON_CHANGE.set(editor, () => {})
unmountRef.current = true
} }
}, [editor, onContextChange]) }, [editor, onContextChange])