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

Sections Not Updating Correctly #84

Open
kermankohli opened this issue Sep 26, 2016 · 2 comments
Open

Sections Not Updating Correctly #84

kermankohli opened this issue Sep 26, 2016 · 2 comments

Comments

@kermankohli
Copy link

've discovered a small bug with the library:

  1. Suppose there are two objects in our current Realm objects array [ A : { "name" = "John"}, B : {"name" = "Sam"} ]. The sectionKeyPath = "name".
  2. At this point, there will be 2 sections in the UITableView: John and Sam.
  3. Now if we change object B's name to "John" it'll put object A and B in the section "John". This is fine.
  4. However, once we change object B's name back to "Sam" it still remains in the section "John" rather than deleting itself from the existing section and creating a new one called "Sam" (like in the beginning).

The current workaround seems to be to check if the old object and new object's sectionKeyPath value has changed (via an if statement) and then calling then forcing the RealmResultsController to re-execute the query via fetch().

Good job with the library, though, love its design!

@isaacroldan
Copy link
Contributor

Hey @kermankohli thanks reporting the bug and for the nice words :)

We'll look into this, we are currently thinking about re-designing the library to use the new Realm features so it may take a bit to see this fixed in master. If you think this should be an easy quick fix, feel free to open a PR and we will merge it in the current version :)

Thanks again!!!

@inPhilly
Copy link

Any update on this?

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

No branches or pull requests

3 participants