Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: inconsistencies with existing vs new entity initialization #17

Merged
merged 11 commits into from Jun 11, 2020

Conversation

tskimmett
Copy link
Contributor

@tskimmett tskimmett commented Jun 5, 2020

  • add isNewDocument property to InitializationContext
    • this will determine whether nested objects without identifiers in an initializing object graph are considered new or not
  • remove id from public entity constructor (EntityConstructorForType<T>)
  • simplify Entity constructor to use only the isNew variable in deciding whether to call init() or set()
  • ensure Entity.__pendingInit__ property is initialized
  • add some tests, fix some tests

@tskimmett tskimmett marked this pull request as ready for review June 5, 2020 21:10
@tskimmett tskimmett requested a review from mattheyan June 5, 2020 21:10
mattheyan
mattheyan previously approved these changes Jun 10, 2020
src/entity.ts Show resolved Hide resolved
@mattheyan mattheyan self-requested a review June 10, 2020 18:54
@tskimmett tskimmett dismissed mattheyan’s stale review June 10, 2020 18:56

Inadvertently approved.

Copy link
Contributor

@mattheyan mattheyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taylor is working on additional changes...

… construction logic

inherit identifier property from baseType

fix/add tests
@tskimmett tskimmett changed the title Don't call set() when constructing an entity using init() fix: inconsistencies with existing vs new entity initialization Jun 11, 2020
@tskimmett tskimmett requested a review from mattheyan June 11, 2020 13:58
- Get rid of trailing whitespace
- Declare function return value as possibly undefined
- Declare isNew variable for clarity
@tskimmett tskimmett merged commit c3942c8 into master Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants