Skip to content

Commit

Permalink
[ios-sdk] Fix bug where place picker could show two selected places
Browse files Browse the repository at this point in the history
Summary:
FBGraphObjectTableDataSource contained a bug where it would fail to deselect an item if the
data had been reloaded since it was selected, because it was looking up objects based on their
object address rather than their ID, and the object address would be different for the same GraphObject
on a subsequent query.

Test Plan:
-Run PlacePickerSample
 Click in search bar
 Type "Apple"
 Select "Applebees"
 Click Cancel
 Click in search bar again
 Type "Apple"
 Select "Apple-Nuts: Apple Cider Donuts"
 Applebees is deselected -- without this fix, it stays selected
- Ran Scrumptious, FriendPickerSample, BooleanOG

Revert Plan:

Reviewers: jacl, mmarucheck, gregschechte, ayden

Reviewed By: jacl

CC: msdkexp@, platform-diffs@lists

Differential Revision: https://phabricator.fb.com/D540720

Task ID: 1327638
  • Loading branch information
Chris Lang committed Aug 6, 2012
1 parent 8fc10a2 commit 7d0bffc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/FBGraphObjectTableDataSource.m
Expand Up @@ -18,6 +18,7 @@
#import "FBGraphObjectTableCell.h"
#import "FBGraphObject.h"
#import "FBURLConnection.h"
#import "FBUtility.h"

@interface FBGraphObjectTableDataSource ()

Expand Down Expand Up @@ -305,7 +306,12 @@ - (NSIndexPath *)indexPathForItem:(FBGraphObject *)item
return nil;
}

NSInteger itemIndex = [sectionItems indexOfObjectIdenticalTo:item];
id matchingObject = [FBUtility graphObjectInArray:sectionItems withSameIDAs:item];
if (matchingObject == nil) {
return nil;
}

NSInteger itemIndex = [sectionItems indexOfObject:matchingObject];
if (itemIndex == NSNotFound) {
return nil;
}
Expand Down

0 comments on commit 7d0bffc

Please sign in to comment.