Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Add invariant that an object with modified properties must be valid. #2278

Closed
wants to merge 4 commits into from

Conversation

NTillmann
Copy link
Contributor

@NTillmann NTillmann commented Jul 17, 2018

Release notes: None

The uncovered bug is tracked in #2279.

@@ -325,6 +325,11 @@ export default class ObjectValue extends ConcreteValue {
// never be serialized.
refuseSerialization: boolean;

// Checks whether effects are properly applied.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see anything that ensures that _isPartial is only true when effects are applied/undone. I thought this was an annotation used in our models/used for snapshotting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to its Flow type definition, _isPartial is AbstractValue | BooleanValue, and it's initialized in the constructor.

The only reason it could ever be undefined is if the effects corresponding to this object have been undone.

@hermanventer
Copy link
Contributor

I'm looking into the bug.

@NTillmann NTillmann mentioned this pull request Jul 25, 2018
@facebook-github-bot
Copy link

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired.

Before we can review or merge your code, we need you to email cla@fb.com with your details so we can update your status.

@hermanventer
Copy link
Contributor

I've verified that this invariant is valid with #2402.

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@trueadm
Copy link
Contributor

trueadm commented Aug 10, 2018

I updated the PR with master and added the check in a bunch of other places. It seems we are hitting more cases now, which is good in some respects. Herman's join PR seems to fix all the failing test cases though.

@NTillmann NTillmann changed the title [New invariant finds bug] Add invariant that an object with modified properties must be valid. Add invariant that an object with modified properties must be valid. Aug 22, 2018
Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

NTillmann is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

trueadm is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants