glimmerjs / glimmer-web-component

Library to boot up your Glimmer components as Web Components
https://glimmerjs.com/guides/using-glimmer-as-web-components
MIT License
30 stars 11 forks source link

Custom Element not working #28

Open ghost opened 6 years ago

ghost commented 6 years ago

1) ember new DisplayTile -b @glimmer/blueprint --web-component=display-table 2) ember b --prodcution 3) < DisplayTile> < /DisplayTile> --> nothing happens 4) < display-title> < /display-title> --> 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.

ajgribble commented 6 years ago

I had the same issue with glimmer/application@0.9.1 (but not 0.8.0). I haven't had a chance to chase down the underlying issue but changing the 'whenRendered' function in initialize-custom-elements.js with the following fixes the issue:

function whenRendered(app, callback) {
  // if (app['_rendering']) {
  if (!app['_rendered']) {
    requestAnimationFrame(() => {
      whenRendered(app, callback);
    });
  } else {
    callback();
  }
}
rbrcurtis commented 6 years ago

I just put up a PR to fix this: https://github.com/glimmerjs/glimmer-web-component/pull/29 (the exception, not the docuementation)

mrosenberg commented 5 years ago

The rendering engine changed from sync to async. Edit your main.ts.

app.boot();
initializeCustomElements(app, {'foo-bar': 'FooBar'});

to

app.boot()
.then(() => {
  initializeCustomElements(app, {'foo-bar': 'FooBar'});
});

That should fix your web component.