Skip to content

Commit c371c1a

Browse files
committed
let mutation() return the last record
instead of the first one
1 parent 8526869 commit c371c1a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dist/vuex-orm-apollo.esm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10252,7 +10252,7 @@ var Action = /** @class */ (function () {
1025210252
insertedData = _a.sent();
1025310253
// Try to find the record to return
1025410254
if (insertedData[model.pluralName] && insertedData[model.pluralName][0]) {
10255-
return [2 /*return*/, insertedData[model.pluralName][0]];
10255+
return [2 /*return*/, insertedData[model.pluralName][insertedData[model.pluralName].length - 1]];
1025610256
}
1025710257
else {
1025810258
Context.getInstance().logger.log("Couldn't find the record of type", model.pluralName, 'in', insertedData, '. Fallback to find()');

src/actions/action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class Action {
3939

4040
// Try to find the record to return
4141
if (insertedData[model.pluralName] && insertedData[model.pluralName][0]) {
42-
return insertedData[model.pluralName][0];
42+
return insertedData[model.pluralName][insertedData[model.pluralName].length - 1];
4343
} else {
4444
Context.getInstance().logger.log("Couldn't find the record of type", model.pluralName, 'in', insertedData,
4545
'. Fallback to find()');

0 commit comments

Comments
 (0)