Skip to content

Commit

Permalink
Drop a leftover useRef() call (#5510)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
e1himself committed Sep 18, 2023
1 parent 70166d6 commit 13c7d27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/flat-coats-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate-react': patch
---

Remove an unused React ref
4 changes: 1 addition & 3 deletions packages/slate-react/src/components/slate.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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)) {
Expand Down Expand Up @@ -66,7 +65,6 @@ export const Slate = (props: {

return () => {
EDITOR_TO_ON_CHANGE.set(editor, () => {})
unmountRef.current = true
}
}, [editor, onContextChange])

Expand Down

0 comments on commit 13c7d27

Please sign in to comment.