I'm using NodeView to render React component which is using react-lazy-load package inside. The code looks like this:
The problem is that react-lazy-load checks whether its DOM element is inside the document or is in the viewport and renders children in this case. Otherwise it renders an empty div. When NodeView's "dom" is accessed, it's not in the DOM yet, but react-lazy-load has already rendered its content there.
Is there any way to know whether "dom" element has been injected into the document? I can see that prosemirror-view is using MutationObserver for selection checks (https://github.com/ProseMirror/prosemirror-view/blob/master/src/domobserver.js) but it's not documented and it's probably not intended for this. Maybe providing a separate handler to EditorView like "handleDOMMutation" would be great. What do you think?