Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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