<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -14,4 +14,9 @@
   return NO;
 }
 
+- (void)tableViewDidLoadModel:(UITableView*)tableView {
+  [tableView reloadData];
+  [super tableViewDidLoadModel:tableView];
+}
+
 @end</diff>
      <filename>src/TTCalendarDataSource.m</filename>
    </modified>
    <modified>
      <diff>@@ -147,7 +147,7 @@ static const CGSize kTileSize = { 46.f, 46.f };
 - (void)setSelectedTile:(TTCalendarTileView *)tile
 {
   if (selectedTile != tile) {
-    [selectedTile setSelected:NO];
+    selectedTile.selected = NO;
     selectedTile = [tile retain];
     tile.selected = YES;
     [delegate didSelectDate:tile.date];</diff>
      <filename>src/TTCalendarGridView.m</filename>
    </modified>
    <modified>
      <diff>@@ -174,6 +174,9 @@
 
 - (void)setMarked:(BOOL)marked
 {
+  if ([self marked] == marked)
+    return; // nothing to do
+  
   if (marked)
     state |= TTCalendarTileStateMarked;
   else</diff>
      <filename>src/TTCalendarTileView.m</filename>
    </modified>
    <modified>
      <diff>@@ -24,8 +24,8 @@
   // Configure the dataSource to display details for |date|.
   [(TTCalendarDataSource*)self.dataSource loadDate:date];
 
-  // Refresh the view to reflect the updated model/dataSource state.
-  [self invalidateModel];
+  // Refresh the details view underneath the calendar grid.
+  [self showModel:YES];
 }
 
 - (BOOL)shouldMarkTileForDate:(NSDate *)date
@@ -46,17 +46,6 @@
 }
 
 // -----------------------------------------------------------------------------------
-#pragma mark TTModelViewController
-
-// TODO: this still doesn't work right (it doesn't update until the user actually
-//       touches somewhere on the calendar--strange).
-- (void)didLoadModel
-{
-  [super didLoadModel];
-  [[self calendarView] refresh];
-}
-
-// -----------------------------------------------------------------------------------
 #pragma mark UIViewController
 
 - (void)loadView
@@ -67,6 +56,14 @@
   self.tableView = [[self calendarView] tableView];
 }
 
+// -----------------------------------------------------------------------------------
+#pragma mark TTModelViewController
+
+- (void)didLoadModel {
+  [super didLoadModel];
+  [[self calendarView] refresh];
+}
+
 // make the compiler happy
 - (TTCalendarView*)calendarView
 {</diff>
      <filename>src/TTCalendarViewController.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7ddfd60cf37c13c70f7da6c0d5555925c8dc64b5</id>
    </parent>
  </parents>
  <author>
    <name>Keith Lazuka</name>
    <email>klazuka@gmail.com</email>
  </author>
  <url>http://github.com/dbgrandi/three20/commit/fb62e7aaa76231754bd6b6239c9c8e9393739b80</url>
  <id>fb62e7aaa76231754bd6b6239c9c8e9393739b80</id>
  <committed-date>2009-07-30T08:57:13-07:00</committed-date>
  <authored-date>2009-07-30T08:56:27-07:00</authored-date>
  <message>Calendar: Fixed a performance issue and a view state bug.

1. Selecting calendar tile performance was abysmal prior to this bug fix because every time we refresh, we were inadvertantly redrawing every single calendar tile. The fix was to only update the tile's &quot;marked&quot; property if it had actually changed, thus avoiding a redraw if there was no change.

2. In cases where the user is using a TTURLRequestModel underneath the calendar, the view was not being updated correctly after the modelDidFinishLoad. That's fixed now.</message>
  <tree>285cbcedb9864b9812f22ee230f4cd7cab33fb89</tree>
  <committer>
    <name>Keith Lazuka</name>
    <email>klazuka@gmail.com</email>
  </committer>
</commit>
