Skip to content

Commit

Permalink
v4.12.3...v5.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wozny1989 committed May 6, 2024
1 parent 2ab09ba commit c749fc6
Show file tree
Hide file tree
Showing 31 changed files with 2,119 additions and 835 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ jobs:
- ember-lts-3.28
- ember-lts-4.4
- ember-lts-4.8
# - ember-release
# - ember-beta
# - ember-canary
- ember-lts-5.4
- ember-release
- ember-beta
- ember-canary
- embroider-safe
- embroider-optimized

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ const ExtendedInfinityModel = InfinityModel.extend({
return params;
},
afterInfinityModel(posts) {
let loadedAny = posts.get('length') > 0;
let loadedAny = posts.length > 0;
this.set('canLoadMore', loadedAny);

this.set('_minId', posts.get('lastObject.id'));
this.set('_minUpdatedAt', posts.get('lastObject.updated_at').toISOString());
this.set('_minId', posts.lastObject.id);
this.set('_minUpdatedAt', posts.lastObject.updated_at.toISOString());
}
});

Expand Down
8 changes: 4 additions & 4 deletions ember-infinity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"test": "echo 'A v2 addon does not have tests, run tests in test-app'",
"prepack": "pnpm run build",
"prepare": "pnpm run build"
"test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
"prepack": "npm run build",
"prepare": "npm run build"
},
"dependencies": {
"@embroider/addon-shim": "^1.8.7",
Expand All @@ -72,7 +72,7 @@
"rollup": "^4.17.0"
},
"peerDependencies": {
"ember-source": "^3.28.0 || ^4.0.0"
"ember-source": ">= 3.28.0"
},
"engines": {
"node": ">= 18"
Expand Down
11 changes: 6 additions & 5 deletions ember-infinity/src/services/infinity.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Service from '@ember/service';
import InfinityModel from '../lib/infinity-model';
import InfinityPromiseArray from '../lib/infinity-promise-array';
import { getOwner } from '@ember/application';
import { get } from '@ember/object';
import { A } from '@ember/array';
import { typeOf } from '@ember/utils';
import { scheduleOnce } from '@ember/runloop';
Expand Down Expand Up @@ -511,17 +512,17 @@ export default class Infinity extends Service {
_doUpdate(queryObject, infinityModel) {
infinityModel.isLoaded = true;

const totalPages = queryObject.get(infinityModel.totalPagesParam);
const count = queryObject.get(infinityModel.countParam);
const totalPages = get(queryObject, infinityModel.totalPagesParam);
const count = get(queryObject, infinityModel.countParam);
infinityModel._totalPages = totalPages;
infinityModel._count = count;
infinityModel.meta = queryObject.meta;

let newObjects;
if (infinityModel.get('_increment') === 1) {
newObjects = infinityModel.pushObjects(queryObject.toArray());
newObjects = infinityModel.pushObjects(queryObject.slice());
} else {
newObjects = infinityModel.unshiftObjects(queryObject.toArray());
newObjects = infinityModel.unshiftObjects(queryObject.slice());
}

this._notifyInfinityModelUpdated(queryObject, infinityModel);
Expand Down Expand Up @@ -569,7 +570,7 @@ export default class Infinity extends Service {
@method _afterInfinityModel
*/
_afterInfinityModel(newObjects, infinityModel) {
let result = infinityModel.afterInfinityModel(newObjects, infinityModel);
const result = infinityModel.afterInfinityModel(newObjects, infinityModel);
if (result) {
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions ember-infinity/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export function checkInstanceOf(infinityModel) {
* @return {Array}
*/
export function convertToArray(queryObject) {
if (queryObject.toArray) {
return queryObject.toArray();
if (queryObject.slice) {
return queryObject.slice();
}
return queryObject;
}
Loading

0 comments on commit c749fc6

Please sign in to comment.