Skip to content

Commit

Permalink
fix: initialize model immediately after the creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ivandotv committed Mar 8, 2022
1 parent 06bff74 commit 654507b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-sloths-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fuerte/core': patch
---

fix: initialize model immediately after the creation
3 changes: 1 addition & 2 deletions packages/core/src/collection/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,7 @@ export class Collection<
if (!modifiedData) {
continue
}
const model = await this.factory(modifiedData)

const model = await Promise.resolve(this.create(modifiedData))
if (this.notPresent(model)) {
modelsToAdd.push(model)
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/collection/LiteCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export class LiteCollection<
continue
}

const model = await this.factory(modifiedData)
const model = await Promise.resolve(this.create(modifiedData))

modelsToAdd.push(model)
}
Expand Down

0 comments on commit 654507b

Please sign in to comment.