Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop a leftover useRef() call #5510

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading