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 a bug where duplicate objects would be inserted #12

Merged
merged 1 commit into from
Aug 13, 2015

Conversation

0ff
Copy link
Contributor

@0ff 0ff commented Aug 12, 2015

Due to the fact changes is an array which may contain duplicates (i.e. multiple objects with the same remoteKey-value), you must make sure to clean remoteObjectIDs from duplicates.
Otherwise it would propagate the duplicates into insertedObjectIDs (which is not a set but an array) which in turn would make the for loop over insertedObjectIDs insert duplicate objects.

Due to the fact `changes` is an array which may contain duplicates (i.e. multiple objects with the same remoteKey-value), you must make sure to clean `remoteObjectIDs` from duplicates.
Otherwise it would propagate the duplicates into `insertedObjectIDs` (which is not a set but an array) which in turn would make the `for loop` over `insertedObjectIDs` insert duplicate objects.
@0ff
Copy link
Contributor Author

0ff commented Aug 12, 2015

I think it makes sense to include this duplicate-handling into DATAFilter, as DATAObjectIDs does away with them the next time you call objectIDsInEntityNamed anyway.

@3lvis
Copy link
Owner

3lvis commented Aug 12, 2015

@0ff Thanks for pointing this out!

@3lvis
Copy link
Owner

3lvis commented Aug 13, 2015

Sounds good! \o/

3lvis added a commit that referenced this pull request Aug 13, 2015
Fix a bug where duplicate objects would be inserted
@3lvis 3lvis merged commit 860e456 into 3lvis:master Aug 13, 2015
@3lvis
Copy link
Owner

3lvis commented Aug 22, 2015

Hi @0ff I had to rever this change since it broke ordered relationships in Core Data.

#12

@3lvis
Copy link
Owner

3lvis commented Aug 22, 2015

I'll check for another way to fix the duplicated items in changes.

@3lvis
Copy link
Owner

3lvis commented Aug 23, 2015

@0ff I made a branch with the mentioned unit tests, please feel free to take a look if you feel like it ❤️

#16

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