react-prosemirror icon indicating copy to clipboard operation
react-prosemirror copied to clipboard

`useEditorEffect` returns stale `view` properties on first render

Open konstantinmuenster opened this issue 5 months ago • 0 comments

Hey - it's me again! 😄 Another subtle issue regarding the ReactEditorView.

We have a non-editable editor that uses node views. These node views have logic that depends on the view.editable prop, which is accessed inside useEditorEffect. We noticed that this property is stale and shows an incorrect value on the first render cycle.

https://github.com/nytimes/react-prosemirror/assets/46243719/9019de0e-2efc-49a2-bab1-f8a72b72a0b6

It would be great if this could be fixed so that either we have the correct values immediately or a view parameter that is null initially to indicate that the correct state is still pending.

konstantinmuenster avatar Jan 30 '24 11:01 konstantinmuenster