ember-fastboot / ember-cli-fastboot

Server-side rendering for Ember.js apps
http://ember-fastboot.com/
MIT License
852 stars 160 forks source link

Schema version 6: lookup fastboot info #823

Closed xg-wang closed 2 years ago

xg-wang commented 3 years ago

Implicit injection is deprecated https://deprecations.emberjs.com/v3.x#toc_implicit-injections

Fixes https://github.com/ember-fastboot/ember-cli-fastboot/issues/819 Depends on https://github.com/ember-fastboot/ember-cli-fastboot/pull/822

This is breaking change because user needs to upgrade to compatible fastboot

rwjblue commented 3 years ago

I think we can do this without a breaking change. The deprecation does nto fire when you call instance.inject it gets called when you the FastBoot service is created. So we can always call instance.inject then we can update fastboot service to use a caching getter to grab the value. Using that setup will avoid the deprecation, and avoid requiring us to rev the schema.

rwjblue commented 3 years ago

See these tests in Ember for examples of how to avoid the deprecation on create:

https://github.com/snewcomer/ember.js/blob/bb607647f107a5046a19e67042bab33ba75f6e62/packages/%40ember/-internals/runtime/tests/system/object/create_test.js#L135-L158

https://github.com/snewcomer/ember.js/blob/bb607647f107a5046a19e67042bab33ba75f6e62/packages/%40ember/-internals/runtime/tests/system/object/create_test.js#L297-L351

These techniques can be used to significantly reduce the changes required to avoid the deprecaiton.

xg-wang commented 3 years ago

@rwjblue oh that's nice, thanks for the examples. I'll update the PR

rwjblue commented 3 years ago

Moved to draft for now (lemme know when ready for another round of review)

xg-wang commented 2 years ago

Closed by https://github.com/ember-fastboot/ember-cli-fastboot/pull/841