tildeio / ember-element-helper

Dynamic element helper for Glimmer templates.
MIT License
44 stars 23 forks source link

`ember-element-helper` doesn't work since update to `0.8.5` #117

Open Shishouille opened 8 months ago

Shishouille commented 8 months ago

Helloo,

With only updating the dependencies, ember-element-helper is not working properly anymore. When calling it this way:

{{#let (element (or-else @as "div")) as |Element|}}
  <Element class={{this.classnames}} {{css-vars this.style}} ...attributes>
    {{yield}}
  </Element>
{{/let}}

We have this Stack Trace: image

Directing us to this assertion:

export default helper(function () {
  // This helper (`element`, as opposed to `-element`) mostly exists to satisfy
  // things like `owner.hasRegistration('helper:element')`. The AST transform
  // replaces all usages of `(element ...)` into `(component (-element ...))`
  // so if this helper is invoked directly, something is wrong.

  assert('The `element` helper polyfill encountered an unexpected error. ' + 'Please report the issue at http://github.com/tildeio/ember-element-helper ' + 'with the usage and conditions that caused this error.');
  return null;
});

Here's the main dependencies versions:

    "@embroider/compat": "3.2.3",
    "@embroider/core": "3.3.0",
    "@embroider/router": "2.1.4",
    "@embroider/webpack": "3.2.0",
    "@ember/render-modifiers": "2.1.0",
    "@glimmer/component": "1.1.2",
    "@glimmer/tracking": "1.1.2",
    "@glint/core": "^1.2.1",
    "@glint/environment-ember-loose": "^1.2.1",
    "@glint/environment-ember-template-imports": "1.2.1",
    "@glint/template": "^1.2.1",
    "ember-auto-import": "2.6.3",
    "ember-cli-babel": "8.2.0",
    "ember-modifier": "4.1.0",
    "ember-source": "5.3.0",
    "ember-element-helper": "0.8.5",

As reference to this issue: https://github.com/cibernox/ember-basic-dropdown/issues/713 ; if we use -element it works. What am I missing here? Is there a config I need to add? For info, I use pnpm and used pnpm dedupe - doesn't change anything.

esbanarango commented 6 months ago

Same issue here:

simonihmig commented 3 months ago

The helper code shown above comes from v0.6.0 of the addon, seems you have an old version, maybe coming from another addon's dependencies! Try to deduplicate those!

villander commented 3 weeks ago

This works for me treating others addon's dependencies

"pnpm": {
    "overrides": {
      "ember-element-helper": "0.8.6"
    }
  }