Vue-material: [mdDialog] .open() -> Failed to execute 'appendChild' on 'Node'

Created on 9 Mar 2017  Â·  9Comments  Â·  Source: vuematerial/vue-material

I'm having an issue using vue-material inside a render(). I'm not sure this is best practice - but it seems it ought to work... I have tried to pair this down to as simple a test case as I possibly can. I fully expect this is my own misunderstanding of this library... Thanks!

Steps to reproduce

  1. Use example here: http://codepen.io/anon/pen/NpdgdG?editors=1010#0 to attempt to open a dialog created within a Vue instance.

Which browser?

Chrome

What is expected?

The dialog opens without errors when .open() is called

What is actually happening?

It seems perhaps the context of the open call is wrong? I've tried using apply a lot to force it correctly but to no avail :(

TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at VueComponent.open (vue-material.js:7)
    at VueComponent.boundFn [as open] (vue.runtime.common.js:127)
    at Vue$2.mounted (loginWindow.jsx:13)
    at callHook (vue.runtime.common.js:2219)
    at mountComponent (vue.runtime.common.js:2113)
    at Vue$2.$mount (vue.runtime.common.js:6676)
    at Vue$2.Vue._init (vue.runtime.common.js:3652)
    at new Vue$2 (vue.runtime.common.js:3733)
    at Object.<anonymous> (loginWindow.jsx:4)
    at __webpack_require__ (bootstrap 51edeba…:19)

Reproduction Link

http://codepen.io/anon/pen/NpdgdG?editors=1010#0

Any help is appreciated - thanks :)

bug

Most helpful comment

had the same problem, fixed it in a similar way as @ndpu but it's more Vue like

 mounted() {
    this.$nextTick(() => {
        this.$refs['dialog1'].open();
    });
}

All 9 comments

Snackbar component has the same problem

I am getting a similar message when closing the dialog.

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. at HTMLDivElement.cleanElement (eval at ../../../../vue-material/dist/vue-material.js ({{url}}/Scripts/Views/Vue/app.js:718:1), <anonymous>:4943:33) cleanElement @ vue-material.js?43da:4677

Thank you.

I will investigate this issue!

works with 0 timeout:

mounted () {
    setTimeout(() => {
      this.$refs['dialogref'].open()               
    }, 0);
}

had the same problem, fixed it in a similar way as @ndpu but it's more Vue like

 mounted() {
    this.$nextTick(() => {
        this.$refs['dialog1'].open();
    });
}

the workaround from @yazfield doesn't work fine for me.

@yazfield solution worked for me.

I have a similar issue. The weird thing is that it happens only when I have a md-menu in the view that calls to the md-dialog and after I go back to the view. Very weird.

Closing this issue as our focus is on the new 1.0.0 version.

Was this page helpful?
0 / 5 - 0 ratings