scottwernervt / ember-cli-group-by Goto Github PK
View Code? Open in Web Editor NEWAn Ember.js helper for grouping objects by async properties.
License: MIT License
An Ember.js helper for grouping objects by async properties.
License: MIT License
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.
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: |
...
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.