guides-source icon indicating copy to clipboard operation
guides-source copied to clipboard

Don't tell people to use @ember/render-modifiers

Open ef4 opened this issue 6 months ago • 1 comments

@ember/render-modifiers was created as a legacy upgrade utility for people who had a large amount of classic Ember components. It is never appropriate for new code. It should not be recommended in the guides. https://guides.emberjs.com/release/components/template-lifecycle-dom-and-modifiers/#toc_calling-methods-on-first-render

ef4 avatar Jan 05 '24 19:01 ef4

Additionally, the docs should not be recommending mutating tracked data in getters. This is a great way to cause infinite revalidation errors.

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';

export default class TextComponent extends Component {
  @tracked _value;

  get value() {
    if (this.args.disabled) {
      return (this._value = '');
    }

    return this._value;
  }

it seems that page is overly focused on keeping pre-octane idioms, rather than "given what you're used to, this is how you do X is a new app".

NullVoxPopuli avatar Jan 08 '24 16:01 NullVoxPopuli