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

Add support for keeping letting cell nodes update to new view models when reloaded. #trivial #357

Merged
merged 6 commits into from Jun 13, 2017

Conversation

Adlai-Holler
Copy link
Member

  • Add -(BOOL)[ASCellNode canUpdateToViewModel:].
    • This, plus the view-model mechanism, may be moved up to ASDisplayNode in the future.
  • If we reload an item, and its existing cell node returns YES from that, we keep using the same node, and update the view model on a background thread, same as we'd allocate a new node.
    • View model change could easily be moved to the main thread in the future.
  • Right now we still forward a reloadItemsAtIndexPaths: call to the UICollectionView, which may mean a flash for animated updates. Suppressing this call is something we do later.
  • Beef up the tests for the new feature.
  • Add a workaround for an issue where you cannot make a partial mock out of ASDisplayNodes due to an OCMock bug.

@Adlai-Holler Adlai-Holler changed the title Add support for keeping letting cell nodes update to new view models when reloaded. Add support for keeping letting cell nodes update to new view models when reloaded. #trivial Jun 13, 2017
Copy link
Member

@nguyenhuy nguyenhuy left a comment

Choose a reason for hiding this comment

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

LGTM!

Probably should mention #195.

@@ -182,21 +222,70 @@ - (void)assertCollectionNodeContent
* Updates the collection node, with expectations and assertions about the call-order and the correctness of the
* new data. You should update the data source _before_ calling this method.
*
* invalidatedIndexPaths are the items we expect to get refetched (reloaded/inserted).
* indexPathsForPreservedNodes are the old index paths for nodes that should use -canUpdateToViewModel: instead of being refetched.
Copy link
Member

Choose a reason for hiding this comment

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

You mean skippedReloadIndexPaths?

@Adlai-Holler Adlai-Holler merged commit 6b3f8f8 into master Jun 13, 2017
@Adlai-Holler Adlai-Holler deleted the AHObjectsPass2 branch June 13, 2017 17:10
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…when reloaded. #trivial (TextureGroup#357)

* Add support for skipping reload if node decides it is compatible with new view model also

* Sort things right

* Put the order back

* No need for redundant expectation

* Fix license header

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

Successfully merging this pull request may close these issues.

None yet

2 participants