-
Notifications
You must be signed in to change notification settings - Fork 62
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
[Glimmer2] DOMException with {{#if}} helper #66
Comments
Glimmer 2 caches the parent element, we need an API to tell glimmer it is reparented, for now you need to wrap dynamic content in a static element |
So put a div around that if |
Thanks @krisselden for the quick feedback. Indeed, your suggestion fixes the problem! If I understand you correctly this workaround will be obsolete once some changes to Glimmer have landed, is that right? Is that already tracked somewhere? |
@simonihmig - Yes, it will likely be fixed by some API collaboration between ember-wormhole and Ember/Glimmer. To help facilitate that, it would be good to get a failing test PR submitted (notice that the canary build is currently passing). |
@rwjblue There you go... |
FYI - We just submitted glimmerjs/glimmer-vm#331 to specifically support ember-wormhole for Ember 2.9... |
* Fix failing tests when using ember with glimmer2. * Access DOM helper using a method that is safe for both pre-glimmer2 and glimmer2. * Wrap the renderedMobiledoc documentFragment in a wrapper div (necessary for glimmer2 teardown, see glimmerjs/glimmer-vm#331 and yapplabs/ember-wormhole#66 (comment)) * Fixes #18. * Update travis node version. * Update package keywords and description.
This is happening in the current ember release build 2.10.0 (and the tests are failing with ember-wormhole@master), anyway I can help? |
@urbany - With latest ember-wormhole and [email protected], you need to have a stable root element inside the wormhole block. This is something that we will continue to iterate and work on, but for now the work around is fairly straightforward. Change: {{#ember-wormhole to="worm"}}
{{#if foo}}
{{/if}}
<p>Other content, whatever</p>
{{/ember-wormhole}} To: {{#ember-wormhole to="worm"}}
<div>
{{#if foo}}
{{/if}}
<p>Other content, whatever</p>
</div>
{{/ember-wormhole}} |
Thanks @rwjblue this solution also works for ember-tether |
Supports Ember 2.10, see yapplabs/ember-wormhole#66 (comment)
Is there a ticket in glimmer for the APIs to move content around and/or tell glimmer to ignore changes to a DOM subtree (or however this is going to work)? I have addons that also teleport content around, and need to figure out how to be compatible with glimmer. Wrapping in a static element doesn't seem to be enough for me... |
Is there a reason this addon does not use glimmerjs/glimmer-vm#331? |
@bstro I think this addon will be rendered unnecessary once that API becomes public. I'm open to PR that reimplements on top of in-element without breaking API. |
@bstro The reason is the API is not available yet? See the RFC: emberjs/rfcs#287 But then there is this polyfill: https://github.com/kaliber5/ember-in-element-polyfill |
The @runspired had a PR to try to get For now, you can work around edge cases by ensuring the content in your wormhole block that is dynamic has a static element around it so its bounds parentNode will be stable (which is what all the tests have and why it works for @lukemelia ). |
Is there any update on resolving this issue? |
@elwayman02 Not on my end, I'm sorry to say. |
Just for information same error happens with |
When testing for compatibility of ember-bootstrap with Glimmer2, I get the following exception with the modal component that uses ember-wormhole:
I narrowed it down to ember-wormhole using a conditional statement, as shown in the following minimalistic example. As soon as
show
is set totrue
, I get the mentioned exception:Here is a demo repo to replicate this bug: https://github.com/simonihmig/ember-wormhole-glimmer2-demo
I am not sure who is to blame here, if it is ember-wormhole or Glimmer2, so first filing this here for the time being...
The text was updated successfully, but these errors were encountered: