Skip to content

ember 5.6+ causes tracking issues (in dev builds - prod builds okay) #110

Open
@Techn1x

Description

@Techn1x

Hello!

I recently started hitting some strange tracking issues with a combination of trackedFunctions and getters. The behaviour I noticed was;

  • a trackedFunction would return a new value, but a getter consuming that wouldn't update (that getter is referenced by another TrackedFunction, which is referenced by another getter, which is then used in a template)
  • bug only occurred in local / dev builds, but was fine in production builds
  • only occurs from ember 5.6+

This gives an idea of what I have. The example is contrived but it represents how my code is structured

abc = trackedFunction(this, async () => {
  const items = await getItems()
  return items
})

// this correctly returns "undefined" while abc is pending, but never runs again when abc is done
get firstItem() {
  return this.abc.value?.[0]
}

// this receives the firstItem "undefined" but never updates
def = trackedFunction(this, async () => {
  if (!this.firstItem) return []
  const manifestBundle = await fetchForItem(this.firstItem)
  return manifestBundle
})

get currentManifestBundle() {
  return this.def.value ?? []
}
{{#each this.currentManifestBundle as |manifest|}}
  ...
{{/each}}

From what I can tell, it is to do with ember-source - 5.4.1 works, 5.6 does not (nor does 5.8).
I've put together this failing PR that might help #109

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions