Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not provide a helper? #28

Open
boris-petrov opened this issue Aug 30, 2024 · 1 comment
Open

Why not provide a helper? #28

boris-petrov opened this issue Aug 30, 2024 · 1 comment

Comments

@boris-petrov
Copy link
Contributor

I'm using this addon with great success, thank you for it! https://github.com/alexlafroscia/ember-context seems to provide a consume-context helper which seems very useful. Why doesn't this addon provide one as well? Is there a particular reason or it just haven't been implemented yet?

@kevinkucharczyk
Copy link
Collaborator

@boris-petrov the current implementation of this addon is strongly tied to the Glimmer engine's component rendering opcodes. Helpers are regular functions that get called with their provided arguments and don't typically have access to the component context they're called in.

That said, I have done some experiments with an implementation that is a little more similar to the ember-context one, where the addon keeps track of the component currently being rendered in a global variable, which could then be used in helpers or modifiers to access context. I've had success with that approach and it may even be a better way to go about it than the current implementation, though I'll have to do a little more testing to verify the stability of it before releasing that sort of change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants