Skip to content

Commit bdd8def

Browse files
committed
dont mutate args object
1 parent 1d708b7 commit bdd8def

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/relay.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,12 @@ export function sequelizeConnection({
217217
if (args.first || args.last) {
218218
options.limit = parseInt(args.first || args.last, 10);
219219
}
220-
if (!args.orderBy) {
221-
args.orderBy = [
222-
[model.primaryKeyAttribute, 'ASC']
223-
];
224-
} else if (orderByEnum && typeof args.orderBy === 'string') {
225-
args.orderBy = [orderByEnum._nameLookup[args.orderBy].value];
220+
221+
let orderBy = args.orderBy || [[model.primaryKeyAttribute, 'ASC']];
222+
if (orderByEnum && typeof orderBy === 'string') {
223+
orderBy = [orderByEnum._nameLookup[args.orderBy].value];
226224
}
227225

228-
let orderBy = args.orderBy;
229226
let orderAttribute = orderByAttribute(orderBy[0][0], {
230227
source: info.source,
231228
args,

0 commit comments

Comments
 (0)