adminizer 4.3.0-build.142 → 4.3.0-build.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,12 @@ export class WaterlineModel extends AbstractModel {
33
33
  return await query;
34
34
  }
35
35
  async _find(criteria = {}, options = {}) {
36
+ // Hack
37
+ const attributes = this.model.attributes;
38
+ const associations = Object.keys(attributes).filter(attr => attributes[attr].model || attributes[attr].collection);
39
+ //@ts-ignore
40
+ if (associations.includes(criteria?.sort?.split(' ')[0]) && JSON.stringify(criteria.where) === '{}')
41
+ criteria.sort = undefined;
36
42
  let query = this.model.find(criteria);
37
43
  if (options.populate && Array.isArray(options.populate) && options.populate.length > 0) {
38
44
  options.populate.forEach(([field, populateCriteria]) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.3.0-build.142",
4
+ "version": "4.3.0-build.143",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",