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

[CLEANUP] drop IE8 stuff #3345

Merged
merged 1 commit into from
Jun 18, 2015
Merged

[CLEANUP] drop IE8 stuff #3345

merged 1 commit into from
Jun 18, 2015

Conversation

stefanpenner
Copy link
Member

  • first pass
  • run against ember canary 4 realz

\
import Adapter from "ember-data/system/adapter";

/**
`DS.FixtureAdapter` is an adapter that loads records from memory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file about?

@stefanpenner stefanpenner force-pushed the drop-ie8 branch 4 times, most recently from a7484bb to 735ae3f Compare June 16, 2015 03:16
@stefanpenner stefanpenner changed the title [CLEANUP] [CLEANUP] drop IE stuff Jun 16, 2015
@stefanpenner stefanpenner changed the title [CLEANUP] drop IE stuff [CLEANUP] drop IE8 stuff Jun 16, 2015
@stefanpenner stefanpenner force-pushed the drop-ie8 branch 2 times, most recently from 9114391 to ecb0c11 Compare June 16, 2015 03:36
@fivetanley
Copy link
Member

Please don't merge until we ship a 2.0 beta. 1.13 needs to support IE8.

@MichaelVdheeren
Copy link

Having 1.13 supporting IE8 would be great thanks :-)

@stefanpenner
Copy link
Member Author

@MichaelVdheeren Ya this is for the version that will work with ember 2

@stefanpenner
Copy link
Member Author

When is 1.13 branched?

forEach(payload, function(single) {
single.type = self.modelNameFromPayloadKey(single.type);
});
payload.forEach((single) => single.type = this .modelNameFromPayloadKey(single.type));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this whitespace intentional?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a typo. I'm surprised jshint didn't warn about that.

@stefanpenner
Copy link
Member Author

Can't connect wifi currently. I'll update tonight

@@ -27,7 +27,7 @@ var get = Ember.get;
@class BuildURLMixin
@namespace DS
*/
var BuildURLMixin = Ember.Mixin.create({
export default Ember.Mixin.create({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really dislike this style as it makes the code less greppable and you also have to undo it later if you have to call reopen or reopenClass.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<ctrl-p> buildurlm (or w/e fuzzy file search the user has) nicely targets the file that it comes from, not confused with consumers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That only works when the file is named appropriately (which seems fine in this specific case), often we have ember-metal/utils which is useless for fuzzy file finders.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwjblue you may have identified a good refactoring, although unrelated to this point.

default export should really have some extremely strong relation to the file it lives in. As that is it's public addressable location.

for example:

// my/adapter.js
import adapter from '../adapter/base'
export default class extend Adapter {

}

The above code relies on strong assumptions, these strong assumption actually help discoverability.

Given that:

  • default exports must have a strong relation to the relative on-disk location
  • consumption is also based on the relative on-disk location ` import foo from 'relative/on-disk/location'
  • source maps indicate relative on-disk location

It appears that the primary identifier is actually this relative on-disk location, any additional hints are redundant and potentially anti-pattern encouraging as consumers relying on these secondary hints are not benefiting from the consistently addressable patterns that aims to stand true regardless of the use-case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if cases exist where the path is not strongly related, that should be considered a bug. If other cases exist where the path isn't searchable, that also appears like a bug.

Even without source maps, searching the built-output for the on-disk location will still reveal the AMD module, as we opt to fully named and resolved modules.

In addition, searching this way can also reveal importers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this line is the only chase where @stefanpenner changed a file to use export default without a name. I think we should merge this pr as is to unblock users who want to test Ember 2.0.

We can bike shed this topic as a separate issue since the Ember Data codebase already contains a mix of both styles.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure why this is controversal, all ember-cli default blueprints do this, and the majority of ember itself does this.

Lets just merge and move on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who can merge it/what's stopping it from being merged? Let's get this in there

@jmurphyau
Copy link
Contributor

Keen on this.. ember data canary doesn't work with ember canary

@stefanpenner
Copy link
Member Author

Keen on this.. ember data canary doesn't work with ember canary

Ya, this PR fixes that.
Rebasing again now, hopefully we can get this in today...

@stefanpenner stefanpenner force-pushed the drop-ie8 branch 2 times, most recently from ec9ed44 to 5f35670 Compare June 18, 2015 16:51
@stefanpenner
Copy link
Member Author

rebase + green on both ember 1.13 (without IE8) and canary

@stefanpenner
Copy link
Member Author

I believe people are anxious to try out ember#canary, this is likely one of the blockers.

as we have branched to v1.13, this should be safe for master. If there are other blockers please let me know.

bmac added a commit that referenced this pull request Jun 18, 2015
@bmac bmac merged commit 0a4aba5 into emberjs:master Jun 18, 2015
@stefanpenner stefanpenner deleted the drop-ie8 branch June 18, 2015 22:18
data = Ember.A(relationshipHash).map(function(item) {
return this.extractRelationship(relationshipMeta.type, item);
}, this);
data = relationshipHash.map((item) => this.extractRelationship(relationshipMeta.type, item));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ember.A() was removed during the cleaning. Was it intentional or by mistake?

Indeed, now it breaks when you normalize a record with hasMany relationships which are not defined in the payload.

REST payload example:

{
    'post': [{
      'id': 2,
      'title': 'Post #2',
      'comments': [] // OK in both 1.13 and 2.0
    }, {
      'id': 3,
      'title': 'Post #3',
      'comments': null // OK in 1.13 *but* KO in 2.0
    }, {
      'id': 4,
      'title': 'Post #4'
      // no comments = OK in both 1.13 and 2.0
    }]
  }

Full tests on JSBin:

For now, the workaround to ensure compatibility with existing data is to override the default normalization and force the undefined relationships to be empty arrays, or even completely remove them.

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

Successfully merging this pull request may close these issues.

10 participants