adopted-ember-addons / ember-launch-darkly

A modern Ember addon to wrap the Launch Darkly service
MIT License
13 stars 24 forks source link

Automatically injecting the launch darkly service #191

Closed chrisvdp closed 4 years ago

chrisvdp commented 4 years ago

Currently, this addon auto injects itself into all routes, all controllers, all components and router:main.

I think this makes consumers code harder to understand. Services should be injected when needed so that it is obvious what this.launchDarkly is referencing in each context.

https://github.com/adopted-ember-addons/ember-launch-darkly#launch-darkly-service

achambers commented 4 years ago

Hi @chrisvdp. Just some context around this.

Originally, what you desire was the case for the same reason you mentioned. However the auto inject behaviour was introduced to make things a little easier for the variation Babel transform (https://github.com/adopted-ember-addons/ember-launch-darkly#experimental-variation-javascript-helper)

I can go deeper in to reasons for the auto inject, as well as the babel transform itself if desired. But just wanted to raise that there is rationale behind things being the way they are right now.

There is also a separate discussion to be had around the transform itself, as I don't think it is even relevant in an @tracked properties world which would possibly make this issue more viable. But there is some thought and discussion around what this addon looks like in an @tracked world that I've not yet dived in to.

Would be good to start those discussions though /cc @mansona @jaredgalanis

achambers commented 4 years ago

Started a new issue (#201) for the discussion around this addon in an @tracked world which should address this issue. Closing this one for now. Hope that's cool @chrisvdp .