-
Notifications
You must be signed in to change notification settings - Fork 19
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
make didInsertNode promise aware. fixes #57 #59
Conversation
@miguelcobain, this is working great for me! When using my branch I had noticed that the children would fire Anyway, this works great in my project. Seems like making Thanks for this! |
Oh, I should also mention that I'm able to run tests locally now on this branch. |
@miguelcobain, I took a stab at adding a test for callback ordering in #60 (which is pointed at the branch for this PR). If we care about children being called in the same order that they were added we have to |
@jagthedrummer I added some tests. QUnit's Failing test is |
@jagthedrummer I refactored the project. It should be working now. Both Can you test if this works on your codebase? |
After switching to this branch I'm getting an error which seems to be preventing
And this is the bit of code that the first line of the stack trace points to: It seems like |
This is weird. Are you 100% sure it comes from ember-composability-tools? |
OK, after studying all the changes in this PR I see that it's due to this PR introducing a breaking change. I'm extending I had to change this: <div
{{did-insert this.didInsertNode}}
{{will-destroy this.willDestroyNode}}
>
...
</div> To this: <div
{{did-insert this.setup}}
>
...
</div> Fwiw, this is related to the fact that I'm still extremely unclear on whether the intended use for But confusion aside, once I updated my project to account for the breaking change everything seems to be working fine. |
@jagthedrummer I see. I think I should fix that story. The problem with extending Root or Node is that the template gets overriden, which is an important part of how the whole system works. I think the best way at the moment is to use Root and Node directly in your own components. Definitely the "safest" way. If you don't need |
Is there anything I can do to help get this landed and released? |
Yay! Thanks so much, @miguelcobain. Any chance you could publish a new release? |
@jagthedrummer version |
Thanks a bunch, @miguelcobain! And thanks again for this excellent addon. I owe you a few beverages if there's ever the opportunity. Cheers! |
@jagthedrummer this version seems to pass the tests
Changes from your PR:
Promise.all
on all the children'sdidInsertNode
calls. Your version was basically not doing any waiting since you were calling forEach, which isn't promise aware.this._didSetup = true;
to the top of thesetup
function which is important for the timing of theregisterChild
which callssetup
Can you try this on your codebase?
I would love to add tests for this, but I didn't find a good way to test execution order with promises. 😞
I'm also considering if it makes sense to make
willDestroyParent
promise aware.