Skip to content

Document how to update arrays and objects in Ember Octane #1539

Open
@ijlee2

Description

@ijlee2

Background

Description

We currently don't describe well how to update tracked arrays and objects in Ember Octane. On Discord, now and then, a developer does ask how they can do so.

@tracked myArray = [];
@tracked myObject = {};

@action updateMyArray() {
  // How?
}
@action updateMyObject() {
  // How?
}

Possible TODOs

1. Arrays

  • Create an example (the example may need to depend on the surrounding page context)
  • Explain that Ember does not react to this.myArray.push(...);.
  • Explain possible solutions
    • immutable approach
    • EmberArray
    • tracked-built-ins

2. Objects

  • Create an example (the example may need to depend on the surrounding page context)
  • Explain that Ember does not react to this.myObject.myProperty = ...;.
  • Explain possible solutions
    • immutable approach
    • native class
    • tracked-built-ins

3. Backport

Once the changes are approved for release directory, backport the changes all the way back to Ember 3.15.

Questions

  • We have 2 pages (Autotracking In-Depth & Tracked Properties) with almost similar content. Can one page refer to another?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions