Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Ember 2.10 #25

Open
tmeloliveira opened this issue Nov 29, 2016 · 9 comments
Open

Problems with Ember 2.10 #25

tmeloliveira opened this issue Nov 29, 2016 · 9 comments
Assignees

Comments

@tmeloliveira
Copy link

tmeloliveira commented Nov 29, 2016

I've just updated my project to the latest version of Ember.js (2.10.0) which comes with Glimmer 2 enabled by default and I'm getting multiple errors when I try to drag and drop my elements. They come in three types:

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Uncaught DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
Uncaught Error: Cannot call next() on an empty iterator

With the previous version of Ember I was using, 2.8.0 it was working just fine.

Any thoughts on that?

@pksjce
Copy link

pksjce commented Dec 27, 2016

Hey @tmeloliveira - I am currently out of touch with the Ember ecosystem and thus have not tried Glimmer.
However any PR's are welcome!

@tmeloliveira
Copy link
Author

tmeloliveira commented Jan 5, 2017

@pksjce thanks for the reply!

Just one more question...
I was looking at this issue on dragula:
bevacqua/dragula#188 (comment)

It seems there could be a workaround, but I would need to access drake.
Is there a way I can do this via ember-dragula?

I wanted to run this drake.cancel(true)...

@oskarrough
Copy link
Contributor

oskarrough commented Jan 5, 2017

It seems there could be a workaround, but I would need to access drake.
Is there a way I can do this via ember-dragula?

@tmeloliveira check https://github.com/kalcifer/ember-dragula#advanced-usage.

@tmeloliveira
Copy link
Author

@oskarrough thanks for the help!

But I wanted to access drake in my JS code... Not in the template...

In my component, lets say I have something similar to this:

{{#ember-dragula config=dragulaconfig drop='updateItem' as |drake|}}
    <div>
        {{#ember-dragula-container drake=drake}}
            <div>drag me</div>
            <div>or me</div>
        {{/ember-dragula-container}}
    </div>
{{/ember-dragula}}

But I want to call drake.cancel(true) from within the updateItem event handler.

@oskarrough
Copy link
Contributor

Ah right, I haven't tried it but perhaps the drake instance is available as the second argument in the event handlers?

https://github.com/kalcifer/ember-dragula/blob/master/addon/components/ember-dragula.js#L37

@tmeloliveira
Copy link
Author

Well, that solved my issue @oskarrough!

Thank you so much for the help! I have been fighting this bug for quite some time!

But... I think there is a problem with the versioning of ember-dragula. This line of code you mentioned in your comment was not present in my version of the addon in node_modules!

"ember-dragula": "1.9.3",

I only saw that because I had forked the project, and was using my version of it...
So I'm only getting the latest code if I import like this:

"ember-dragula": "https://github.com/kalcifer/ember-dragula.git",

Would this be related to the git tag?

@tmeloliveira
Copy link
Author

If anyone is interested, there is more discussion on the original bug here:
glimmerjs/glimmer-vm#358

My solution was to "cancel" the drop event... and then I would update the model and let ember do the re-rendering!

@oskarrough
Copy link
Contributor

Seems the change to include drake in the event arguments hasn't been released yet. We could try to ping @kalcifer for a new release :)

@pksjce
Copy link

pksjce commented Feb 27, 2017

@oskarrough - Would be happy to give you access to the repo for new releases. Sorry for the delay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants