Giter Site home page Giter Site logo

scottwernervt / ember-cli-group-by Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 587 KB

An Ember.js helper for grouping objects by async properties.

License: MIT License

JavaScript 86.76% HTML 13.24%
ember-addon ember-cli-addon ember emberjs groupby

ember-cli-group-by's People

Contributors

ember-tomster avatar scottwernervt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ember-cli-group-by's Issues

Missing (default) category does not work for async relationships.

Reduce fails if nested async belongsTo property is undefined:

const itemGroup = paths.reduce((previous, path) => {
  const previousItem = RSVP.resolve(previous);
  return previousItem.then(nestedItem => get(nestedItem, path));
}, item);
VM250 ember.debug.js:18008 Assertion Failed: 
 Cannot call get with 'name' on an undefined object.

Discovered while creating ember-twiddle demo.

Tests fail for ember-lts-2.4 and ember-lts-2.8 with contentisFulfilled and isFulfilled

All integration tests are failing for Ember 2.4 and 2.8 LTS:

not ok 5 Chrome 58.0 - helper:group-by-path: It groups by given single path
    ---
        actual: >
            contentisFulfilled
        expected: >
            AabBcd
        stack: >
                at http://localhost:7357/assets/tests.js:249:14
                at tryCatch (http://localhost:7357/assets/vendor.js:70691:14)
                at invokeCallback (http://localhost:7357/assets/vendor.js:70706:15)
                at publish (http://localhost:7357/assets/vendor.js:70674:9)
                at http://localhost:7357/assets/vendor.js:48982:7
                at invoke (http://localhost:7357/assets/vendor.js:17247:16)
        message: >
            AabBcd is the right order
        Log: |
    ...

not ok 5 Chrome 58.0 - helper:group-by-path: It groups by given single path
    ---
        actual: >
            isFulfilled
        expected: >
            AabBcd
        stack: >
                at http://localhost:7357/assets/tests.js:243:14
                at tryCatch (http://localhost:7357/assets/vendor.js:68307:14)
                at invokeCallback (http://localhost:7357/assets/vendor.js:68322:15)
                at publish (http://localhost:7357/assets/vendor.js:68290:9)
                at http://localhost:7357/assets/vendor.js:57770:16
                at invoke (http://localhost:7357/assets/vendor.js:18343:16)
        message: >
            AabBcd is the right order
        Log: |
    ...

Private nested computed properties do not fire when changes made in array.

Bug
Test It watches for nested changes is failing as the helper does recompute when a nested property in the array is changed. This is due to _nestedX computed properties not firing because they are never called.

Unconsumed Computed Properties Do Not Trigger Observers

If you never get() a computed property, its observers will not fire even if its dependent keys change. You can think of the value changing from one unknown value to another.

https://guides.emberjs.com/v2.13.0/object-model/observers

Temp Solution
Call each computed property in recompute function.

Solution
Is there a better way to handle fire observers and computed properties for tracking nested changes?

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.