-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BREAKING BUGFIX] Do not assume null Ember.get targets are all globals #3852
Conversation
I think we want to move this direction, but we also want to make sure we don't break existing apps. We'll have to think about this more. |
Tricky no doubt, but the code in master has some weird inconsistencies this cleans up. The biggest change is in normalizeTuple, but I doubt many apps consume that API. It doesn't even seem like it should be exposed, really. Examples of bad behavior in master:
Looks like I failed to clean up the names of several tests, pushing a fix for that shortly. |
👍 on this, but I share @wagenet's concern we will need to be thorough on this one. |
I think we should probably first add some deprecation warnings in the dev builds so we can ween people off the bad practices. That would help us also collect some additional tests for valid use cases that we might not have tests for. |
@ebryn I suggest another PR that raises deprecation warnings for null-target-non-global get calls, a with-target-but-global-path normalizeTuple calls. Sound right? |
Rebased on top of the ES6 branch and @stefanpenner's perf work |
Rebased again and tests passing. Still blocked on #4124. |
…3852 PR emberjs#3852 changes some edge case behavior for get and normalizeTuple. Ahead of those changes, this commit introduces deprecation notices. * Deprecate get for local paths on global contexts, only if they return data. * Deprecate normalizeTuple calls that return a non-global contenxt and a simple global path.
Rebased. Yet another minor violation of semver from my hands if it goes into 1.x. |
Moved |
@rwjblue can we merge now? |
@mixonic - Needs a rebase, but we agreed that this was good a couple F2F meetings ago (in NYC). |
2d298e8
to
d33ecd8
Compare
bd0fe7f
to
1a3dde2
Compare
* Changes globals to only mean properties starting with $ or a capital letter. * Changes normalizeTuple(obj, 'Foo') to resolve Foo as a global. This makes the behavior consistent with normalizeTuple(obj, 'Foo.bar') which already resolves Foo as a global (and looks up bar). * Changes normalizeTuple(null, 'Foo') to resolve Foo as a global. * Specs normalizeTuple('null', 'foo') to resolve to [undefined, '']. This is unfortunate but needed to keep getPath happy. This code is old, and tricky to modify due to perf optimizations and edge case behavior. It would be great to refactor more heavily at some other date. I've spec'd out more of the current behavior and edge cases in this commit. Fixes emberjs#3760
@rwjblue this passes, and I've updated the changelog. Let me know if you had something else in mind. Excited to close this before it sits open for two years. This is probably the longest span of time between a proposed software change and its realization I have ever authored :-) |
ZOMG ZOMG ZOMG |
[BREAKING BUGFIX] Do not assume null Ember.get targets are all globals
Some bugfixin'.
$
or acapital letter.
normalizeTuple(obj, 'Foo')
to resolveFoo
as a global. This makes the behavior consistent withnormalizeTuple(obj, 'Foo.bar')
which already resolvesFoo
as a global (and looks upbar
).normalizeTuple(null, 'Foo')
to resolveFoo
as a global.normalizeTuple('null', 'foo')
to resolve to[undefined, '']
.This is unfortunate but needed to keep
getPath
happy.This code is old, and tricky to modify due to perf optimizations and edge case behavior. It would be great to refactor more heavily at some other date.
Fixes #3760
/cc @bantic @hejld