mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-12 18:24:03 +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:
5
.changeset/flat-coats-buy.md
Normal file
5
.changeset/flat-coats-buy.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove an unused React ref
|
@@ -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])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user