Since renderNode doesn't pass down the value anymore, the recommended way to get it seems to be through editor.value but that doesn't work well for shouldComponentUpdates. Part of the problem is that editor is a React component and thus a mutable object, which means the same reference will be passed down and prevProps.editor.value will always be equal to nextProps.editor.value because editor.value is a getter returning editor.state.value.
For example, let's imagine a paragraph component with a shouldComponentUpdate that returns false if the value didn't change: reproduction
As you will see, the component is never updated (although the value changes).
Can you explicitly pass the value in as its own prop in renderNode instead of relying on accessing editor.value?
Yes, that's probably what I'll do. I'm currently working on it 馃憤
@Zhouzi ah actually I meant like so:
renderNode = props => {
if (props.node.type === "paragraph") {
return <Paragraph {...props} value={props.editor.value} />
}
}
Sorry if that wasn't clear.
@ianstormtaylor Actually I thought I had given that a try in our code and couldn't make it work. But it does work in the reproduction so I guess I've missed something. Thanks for the heads-up 馃憤
Okay so I can confirm that passing down value as suggested by Ian is the way to go 馃挭