Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
108EAA0A committed Aug 12, 2021
1 parent 137f607 commit f477651
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/slate-react/src/components/leaf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import String from './string'
import { PLACEHOLDER_SYMBOL } from '../utils/weak-maps'
import { RenderLeafProps } from './editable'

// auto-incrementing key for String component, force it refresh to
// prevent inconsistent rendering by React with IME input
let keyForString = 0
/**
* Individual leaves in a text node with unique formatting.
*/
Expand All @@ -25,7 +28,13 @@ const Leaf = (props: {
} = props

let children = (
<String isLast={isLast} leaf={leaf} parent={parent} text={text} />
<String
key={keyForString++}
isLast={isLast}
leaf={leaf}
parent={parent}
text={text}
/>
)

if (leaf[PLACEHOLDER_SYMBOL]) {
Expand Down

0 comments on commit f477651

Please sign in to comment.