Version
3.5.24
Reproduction link
play.vuejs.org/
Steps to reproduce
- click "Remove Target" to remove the target element (which has a v-if directive on it)
- toggle "Show Target" to trigger the v-if directive's hide behavior
- note the error that is thrown "Cannot read properties of null (reading 'insertBefore')"
What is expected?
Toggling a v-if for an unbound element should be a no-op. Nothing should change.
What is actually happening?
An uncaught error is being thrown, which can break other parts of a complex application.
This bug was encountered when interacting with other custom directives. A local change to Vue to include a null check against the "parent" in "nodeOps.insert" within "runtime-dom.esm-bundler.js" resolves the issue.