Collaborative Editor - Issues with view and dispatch calls

We are building a collaborative editor using ProseMirror and WebSockets and noticed the editor sometimes starts throwing a crazy number of errors. Looking through the call stack the errors were caused by bad dispatch calls, specifically when view.docView did not exist. Our hacky patch this was to replace

view.dispatch(...args)

with

view.docView && view.dispatch(...args)

This feels especially hacky since docView is not described in the ProseMirror documentation. Is there a better approach?

Where do the dispatch calls that are fired before docView is initialized (or after the editor was destroyed) come from?