From 13c7d271e35406a2497e78ef114417ad17796c65 Mon Sep 17 00:00:00 2001 From: Ivan Voskoboinyk Date: Mon, 18 Sep 2023 20:32:55 +0300 Subject: [PATCH] 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 --- .changeset/flat-coats-buy.md | 5 +++++ packages/slate-react/src/components/slate.tsx | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changeset/flat-coats-buy.md diff --git a/.changeset/flat-coats-buy.md b/.changeset/flat-coats-buy.md new file mode 100644 index 0000000000..282b4befe1 --- /dev/null +++ b/.changeset/flat-coats-buy.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Remove an unused React ref diff --git a/packages/slate-react/src/components/slate.tsx b/packages/slate-react/src/components/slate.tsx index 83204940f5..2e1d69d730 100644 --- a/packages/slate-react/src/components/slate.tsx +++ b/packages/slate-react/src/components/slate.tsx @@ -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(() => { if (!Node.isNodeList(initialValue)) { @@ -66,7 +65,6 @@ export const Slate = (props: { return () => { EDITOR_TO_ON_CHANGE.set(editor, () => {}) - unmountRef.current = true } }, [editor, onContextChange])