[BUGFIX release] MODEL_FACTORY_INJECTIONS is now always false.#15204
[BUGFIX release] MODEL_FACTORY_INJECTIONS is now always false.#15204
Conversation
|
This (if others agree) should likely join w/e release/beta/canary that disables double extend so that ember-data works correctly even if the user has the flag set to true. |
| // default false | ||
| ENV.MODEL_FACTORY_INJECTIONS = defaultFalse(ENV.MODEL_FACTORY_INJECTIONS); | ||
| // always false | ||
| Object.defineProperty(ENV, 'MODEL_FACTORY_INJECTIONS', { |
There was a problem hiding this comment.
We should issue a deprecation if MODEL_FACTORY_INJECTIONS in ENV, and update ember-cli to confirm it isn't specified in the blueprint.
Then instead of setting it to false here, we just leave it undefined (which would also be seen as falsey by ED's assertion).
packages/ember/lib/index.js
Outdated
| set(value) { ENV.MODEL_FACTORY_INJECTIONS = !!value; }, | ||
| get() { return false; }, | ||
| set(value) { | ||
| Ember.logger.warn('As of 2.13.x MODEL_FACTORY_INJECTIONS has no power, feel free to remove it from app/app.js'); |
There was a problem hiding this comment.
Should be an assertion, and this whole Object.defineProperty block should be in an if (DEBUG) {.
There was a problem hiding this comment.
Assertion sounds good but I don't think we can strip the flag as users who ignore the deprecation and set the flag to true will have a bad time.
There was a problem hiding this comment.
@stefanpenner - Setting it to true has literally no effect in production builds. The only usage that I can see in Ember Data is here which is also in an if (DEBUG) and therefore stripped in production builds.
The only thing we need to make sure to do here, is blow up if someone attempts to Ember.ENV.MODEL_FACTORY_INJECTIONS = <anything> in debug builds, because in production builds there is no behavior changes anyways...
|
Also, I agree, we should backport to release branch for a 2.13.1 release. |
This is a tad tricky, as it may be confusing for users upgrading ember + ember-cli but not ember-data ? Thoughts? |
|
The ember-cli blueprints assume the package versions specified in that blueprints package.json. If the user isn't updating ember-data, they can't remove the flag either. The main things I'm concerned with (and my comments would address) are:
|
Ya, it has an affect that effect is backward compact to ease upgrading. Let keep it around for an LTS and then drop it? (like other deprecations) Sounds ok? |
It actually has no effect in production versions (as I mentioned and linked to code for in another comment), I'm super happy to keep both the deprecation (when |
|
FWIW, I checked ember-data back to v2.2.0 and the only thing that it was using the |
Ya good point. Ok we can strip that one out in prod builds! |
59ad983 to
5568817
Compare
| false, | ||
| { | ||
| id: 'ember-metal.model_factory_injections', | ||
| until: '3.0.0', |
There was a problem hiding this comment.
@rwjblue should I make this page or is this deprecation self-explanatory?
There was a problem hiding this comment.
Hmm, good question. This isn't really a deprecation per-se, just a handy warning that a setting that used to matter doesn't any more.
We can either swap this with a warn (instead of deprecate) or leave it as a deprecation and say until: "2.17.0"...
packages/ember/lib/index.js
Outdated
| false, | ||
| { | ||
| id: 'ember-metal.model_factory_injections', | ||
| until: '3.0.0', |
| { | ||
| id: 'ember-metal.model_factory_injections', | ||
| until: '3.0.0', | ||
| url: 'http://emberjs.com/deprecations/v2.x#toc_code-ember-model-factory-injections' |
rwjblue
left a comment
There was a problem hiding this comment.
This is looking good, I'm happy with either deprecate or warn here. If we leave it as deprecate we need to add a section to the website to link to...
| if (DEBUG) { | ||
| if ('MODEL_FACTORY_INJECTIONS' in ENV) { | ||
| deprecate( | ||
| 'Ember.MODEL_FACTORY_INJECTIONS is no longer required', |
There was a problem hiding this comment.
I think this should be EmberENV.MODEL_FACTORY_INJECTIONS?
| false, | ||
| { | ||
| id: 'ember-metal.model_factory_injections', | ||
| until: '3.0.0', |
There was a problem hiding this comment.
Hmm, good question. This isn't really a deprecation per-se, just a handy warning that a setting that used to matter doesn't any more.
We can either swap this with a warn (instead of deprecate) or leave it as a deprecation and say until: "2.17.0"...
|
PR to removing these from blueprints: ember-cli/ember-cli#7025 |
9c18c16 to
277b009
Compare
|
deprecations PR to website: emberjs/website#2895 |
277b009 to
f71c82d
Compare
|
@rwjblue r? |
1 similar comment
|
@rwjblue r? |
|
@rwjblue let me know if this should be |
f71c82d to
eb99506
Compare
|
updated to release as per @rwjblue's suggestion. |
Double extend means this flag no longer means what it once did. To ensure ember-data functions correctly, we should now force it to always be false.
eb99506 to
84ba295
Compare
Double extend means this flag no longer means what it once did. To ensure ember-data functions correctly, we should now force it to always be false.
Code affect in ember-data is: https://github.com/emberjs/data/blob/e6cb564bdb33da4b3c15c3c668dc4b1fdafdf190/addon/-debug/index.js#L37-L39