Skip to content

Commit

Permalink
dont mutate args object
Browse files Browse the repository at this point in the history
  • Loading branch information
mickhansen committed Feb 25, 2018
1 parent 1d708b7 commit bdd8def
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,12 @@ export function sequelizeConnection({
if (args.first || args.last) {
options.limit = parseInt(args.first || args.last, 10);
}
if (!args.orderBy) {
args.orderBy = [
[model.primaryKeyAttribute, 'ASC']
];
} else if (orderByEnum && typeof args.orderBy === 'string') {
args.orderBy = [orderByEnum._nameLookup[args.orderBy].value];

let orderBy = args.orderBy || [[model.primaryKeyAttribute, 'ASC']];
if (orderByEnum && typeof orderBy === 'string') {
orderBy = [orderByEnum._nameLookup[args.orderBy].value];
}

let orderBy = args.orderBy;
let orderAttribute = orderByAttribute(orderBy[0][0], {
source: info.source,
args,
Expand Down

0 comments on commit bdd8def

Please sign in to comment.