Skip to content

Commit

Permalink
Exclude 'id' from sort field
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamFilipek92 committed May 22, 2020
1 parent 04f648f commit f4f367d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-admin-firebase-test",
"description": "A firebase data provider for the React Admin framework",
"version": "3.2.7",
"version": "3.2.9",
"peerDependencies": {
"firebase": "^7.9.x",
"react": "^16.x",
Expand Down
1 change: 0 additions & 1 deletion src/providers/DataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export function DataProvider(
}
return res;
} catch (error) {
console.log('ERROR', error);
const errorMsg = error.toString();
const code = errorMsg ? retrieveStatusCode(errorMsg) : null;
const errorObj = { status: code, message: errorMsg, json: res };
Expand Down
3 changes: 2 additions & 1 deletion src/providers/database/FirebaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class FirebaseClient implements IFirebaseClient {
const snapshots = await query.get();

if (snapshots.docs.length === 0) {
log("apiGetListLazy - result", { message: 'There are not records for given query' });
return { data: [], total: 100000 };
}

Expand Down Expand Up @@ -402,7 +403,7 @@ export class FirebaseClient implements IFirebaseClient {
}

private sortToQuery(query: Query, sort: { field: string, order: string }): Query {
if (sort != null) {
if (sort != null && sort.field !== 'id') {
const { field, order } = sort;
const parsedOrder = order.toLocaleLowerCase() as OrderByDirection;
query = query.orderBy(field, parsedOrder);
Expand Down

0 comments on commit f4f367d

Please sign in to comment.