Giter Club home page Giter Club logo

ember-factory-for-polyfill's People

Contributors

ef4 avatar ember-tomster avatar emrvb avatar jasonmit avatar rwjblue avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ember-factory-for-polyfill's Issues

Peer Review

The goal of this library is to provide a .factoryFor implementation that is as close as possible to the one in Ember 2.12+. There are obviously some things that fall short (e.g. it is impossible to prevent double extend when using .factoryFor in Ember versions prior to 2.12), but every attempt was made to be true to the original RFC.

I'd like to get some review on this from the following folks that were involved in the original implementation of this feature in Ember 2.12+:

The primary polyfill is located at vendor/ember-factory-for-polyfill/index.js.

Force errors upon deprecation.

Current under Ember 2.12 we are triggering the owner._lookupFactory deprecation. We should fix that and start throwing errors when a deprecation occurs (to ensure this library does not introduce deprecations).

Do we support Ember 2.0 - 2.2?

Right now the Ember.getOwner functionality in Ember < 2.3 is provided by ember-getowner-polyfill. We could make that addon add the factoryFor implementation, but it is slightly annoying since we'd have to duplicate a bunch of the test setup and whatnot.

Error: You attempted to access "nodeType" on a factory manager created by container#factoryFor. "nodeType" is not a member of a factory manager.

Originally reported in emberjs/ember.js#15033 and testem/testem#1105.

This error is emitted from here when Testem tries to read value.nodeType.

Error: You attempted to access "nodeType" on a factory manager created by container#factoryFor. "nodeType" is not a member of a factory manager.
    at Object.get (index.js:27)
    at derez (testem.js:70)
    at derez (testem.js:108)
    at derez (testem.js:108)
    at derez (testem.js:108)
    at derez (testem.js:99)
    at derez (testem.js:108)
    at decycle (testem.js:116)
    at Object.serializeMessage (testem.js:906)
    at Object.sendMessageToIframe (testem.js:840)

Offending line in Testem: public/testem/decycle.js#L67.

I'm unable to create a minimal reproduction scenario, but here are some findings:

// component => a class instance with cyclic references
// component.serialize() => a flat POJO

console.log(comment); // Works. Logs a class instance with cyclic dependencies.
console.log(comment.serialize()); // Works. Logs a flat POJO.
console.log(JSON.stringify(comment.serialize())); // Works, logs a string.
console.log(comment, comment.serialize()); // Crashes with the above error
console.log(comment, JSON.stringify(comment.serialize())); // Also crashes

PS You can't even imagine how frustrating this has been. The issue was appearing out of nowhere and then, after hours of frustration, disappearing into the blue. Every time I attributed the issue and fix to an unrelated change in my code. Testem trolled me into becoming one of those superstitious pigeons: I was resolving it by changing store.createRecord to store.push, by cleaning tmp/ and dist/, etc.

I would never even consider that the console.log invocation itself was the reason. My developer instinct was telling me to ignore it, believing it has no side effects. The stack trace never linked to the offending line, even with the Async checkbox enabled.

Upgrade to ember-cli-babel@^6.0.0

This addon is outdated with the recent Ember versions

ember-factory-for-polyfill@^1.1.0:
  version "1.1.2"
  resolved "https://registry.yarnpkg.com/ember-factory-for-polyfill/-/ember-factory-for-polyfill-1.1.2.tgz#ea802002ec55154eea7be82abb586e77429be579"
  dependencies:
    ember-cli-babel "^5.1.7"
    ember-cli-version-checker "^1.2.0"
$> ember -v

ember-cli: 2.14.1
node: 8.2.1
os: darwin x64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.