Skip to content

[Feature] stack based plain-function-helper access to the owner during rendering #20997

@NullVoxPopuli

Description

@NullVoxPopuli

I don't want to write an RFC for this right now, as I think it'd be better to prototype the code first

during render, we always know the owner.

so when when invoking a helper (plain function or not), we could do:

// internal psuedo-code
setActiveOwner() // global
invokeHelper(usersHelper) // the users helper
clearActiveOwner(); // global

and then

function usersHelper() {
  let owner = getOwner();

  assert('..', owner);

  let service = owner.lookup('...');

  return service.format(....)
}

this way folks don't need to use class-based helpers or resources to get access to the owner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions