Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Conversation

nguyenhuy
Copy link
Contributor

#684, #693.

@levi, @Adlai-Holler: Please also let me know your thoughts on this PR. Thanks.

@levi
Copy link
Contributor

levi commented Oct 19, 2015

Gonna check this out tonight, @nguyenhuy.

Copy link
Contributor

Choose a reason for hiding this comment

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

asdk_inverseCompare, or switch asdk_isFlowLayout to match.

@levi
Copy link
Contributor

levi commented Oct 20, 2015

Clean addition on top of data controller. Would love it if the reasoning behind the design was well documented at the ASChangeSetDataController level (as described in a massive conversation in #684) and @Adlai-Holler's design of the change set objects at the internal level. Thanks for doing this, @nguyenhuy , I can tell you there will be a few happy people on my team once this lands. 👍

@nguyenhuy
Copy link
Contributor Author

@levi Thanks for taking a look. I agree with you that ASChangeSetDataController deserves a better documentation. I'm just not so sure whether people would agree with me about the class existence. Its reasonings are separation of concerns, no UITableView/UICollectionView specific behaviours embedded in ASDataController and therefore reducing its complexity. Another minor benefit is that developers can switch back to ASDataController if ASChangeSetDataController causes any problems. I will add more documentation once others approve this approach.

That's said, it's really helpful if you could point out what are the things you would love to see in the documentation, from a new user (of that class) point of view.

@appleguy
Copy link
Contributor

@nguyenhuy can you look at the test failures with the build? I did try re-running it, in case it was a flaky test, but it seems like it probably isn't.

@appleguy
Copy link
Contributor

BTW - this is an extremely awesome patch and another huge contribution to the community. I can't believe how fast you did this following @levi's diff landing, lol!! Thank you!

@nguyenhuy
Copy link
Contributor Author

Sure, I will look at the failed test. Looks like its the same one reported in #758.

Although I believe this diff should work nicely with @levi's supplementary-view feature, I admit that I haven't looked at the underlying diff closely and there might be some integration problems that I overlooked. I will recheck everything.

@appleguy
Copy link
Contributor

Awesome! @nguyenhuy once the test is fixed, do you consider this diff ready to land, or believe that any iteration is needed?

@nguyenhuy
Copy link
Contributor Author

Probably one iteration needed. I will add short documentation and some tests, as well as fixing small implementation details in _ASHierarchyChangeSet.

@levi
Copy link
Contributor

levi commented Oct 22, 2015

@nguyenhuy just a quick glance at the conversations in the other issues, I'd love to see the documentation talk about the native ordering in UITableView/UICollectionView and that the ASChangeSetDataController is designed to simulate those characteristics. It's not entirely apparent to most people that table and collection views have a specific ordering of modification events.

@nguyenhuy
Copy link
Contributor Author

@levi: yes, I will write that down. Thanks!

@Adlai-Holler
Copy link
Contributor

Awesome PR! Pursuant to @levi's point, maybe include this link: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TableView_iPhone/ManageInsertDeleteRow/ManageInsertDeleteRow.html#//apple_ref/doc/uid/TP40007451-CH10-SW17

The xcdoc:// variant would be better but I can't get it to jump down to that specific section near the bottom of the document

@nguyenhuy nguyenhuy mentioned this pull request Oct 25, 2015
@nguyenhuy nguyenhuy force-pushed the DataControllerSortedTransaction branch from ec1b33f to 7e3df3b Compare October 25, 2015 17:44
@nguyenhuy
Copy link
Contributor Author

@levi I removed duplicate steps in _ASHierarchyChangeSet in 7e3df3b 2b0829c. Please help me to review it.

@levi, @Adlai-Holler: I also added documentation to ASChangeSetDataController. Let me know what you think. Thanks.

@appleguy This PR is more or less ready to land. I will write some tests for these new classes in the next few days (and push to a new PR if this one landed by then).

@nguyenhuy nguyenhuy force-pushed the DataControllerSortedTransaction branch from 7e3df3b to 2b0829c Compare October 25, 2015 17:54
@appleguy
Copy link
Contributor

@nguyenhuy Thanks! Do you think this is safe to include the 1.9 release if I were to push it today? I would like to do the release today, and having this improvement would definitely be a milestone.

@nguyenhuy
Copy link
Contributor Author

Yeah it would be nice to have this diff tested by other users. I will act quickly on any problems reported.

@appleguy
Copy link
Contributor

@nguyenhuy could you take a quick look at the test failures now occurring on master? I'm downloading Xcode 6.4 so I can try to reproduce locally, but it's definitely blocked my work for the weekend (wanted to get a lot of PRs merged today, but lots else to do, like writing release notes / preparing release / working on documentation / ASPagerNode etc)

@nguyenhuy
Copy link
Contributor Author

Btw, the failed test looks familiar and should be resolved by #770.

@nguyenhuy
Copy link
Contributor Author

Yeah, looking at the failures on master.
On Oct 25, 2015 10:13 PM, "appleguy" notifications@github.com wrote:

@nguyenhuy https://github.com/nguyenhuy could you take a quick look at
the test failures now occurring on master? I'm downloading Xcode 6.4 so I
can try to reproduce locally, but it's definitely blocked my work for the
weekend (wanted to get a lot of PRs merged today, but lots else to do, like
writing release notes / preparing release / working on documentation /
ASPagerNode etc)


Reply to this email directly or view it on GitHub
#753 (comment)
.

@appleguy
Copy link
Contributor

@nguyenhuy it looks like master is green, but even re-running the tests here is failing. It's possible the test is still flaky but I think this diff may have actually regressed something.

Check out the build...

Failures:
0) -ASTableViewTests testRelayoutAllRowsWithZeroSizeInitially
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
/Users/travis/build/facebook/AsyncDisplayKit/AsyncDisplayKitTests/ASTableViewTests.m:426: ((node.numberOfLayoutsOnMainThread) equal to (1)) failed: ("0") is not equal to ("1"):
423 for (int row = 0; row < NumberOfRowsPerSection; row++) {
424 NSIndexPath indexPath = [NSIndexPath indexPathForRow:row inSection:section];
425 ASTestTextCellNode *node = (ASTestTextCellNode *)[tableView nodeForRowAtIndexPath:indexPath];
426 XCTAssertEqual(node.numberOfLayoutsOnMainThread, 1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
427 XCTAssertEqual(node.constrainedSizeForCalculatedLayout.max.width, newSize.width);
428 }
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
*
TEST FAILED: 213 passed, 1 failed, 0 errored, 214 total ** (49140 ms)

@appleguy
Copy link
Contributor

@nguyenhuy "fortunately", it looks like the test failures are real. I re-confirmed master is passing tests on Xcode 6.4 locally, and checked out this PR to run them again and got the same failure as the builedbot (2 total tests in my case though, both testRelayoutAllRowsWithZeroSizeInitially and testRelayoutAllRowsWithNonZeroSizeInitially).

@nguyenhuy
Copy link
Contributor Author

I think it's because Travis run the tests without virtually/temporary merging this branch into master, i.e the new fix on master isn't included. Let me rebase this branch.

@nguyenhuy nguyenhuy force-pushed the DataControllerSortedTransaction branch from 2b0829c to ecc5e1a Compare October 26, 2015 04:22
@appleguy
Copy link
Contributor

Oh, weird that it didn't rebase when re-running the build. I'm pretty sure it normally does that, but maybe some other automatic action usually triggers the rebase builds. Thanks, I'm excited to have almost all the open PRs merged.

Now we need master to be hit with a day of testing to pave out the recent table changes. I'd like to reset the 1.9 release tag point to include the recent improvements, if at all possible.

Could folks bump the ASDK version you're testing against and let us know if you hit anything? @rcancro, @eanagel, @levi, @Adlai-Holler

@appleguy
Copy link
Contributor

@nguyenhuy hmm, still failed in the number of layouts on main thing...

https://travis-ci.org/facebook/AsyncDisplayKit/jobs/87395262

/Users/travis/build/facebook/AsyncDisplayKit/AsyncDisplayKitTests/ASTableViewTests.m:426: ((node.numberOfLayoutsOnMainThread) equal to (1)) failed: ("0") is not equal to ("1"):
423 for (int row = 0; row < NumberOfRowsPerSection; row++) {
424 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
425 ASTestTextCellNode *node = (ASTestTextCellNode *)[tableView nodeForRowAtIndexPath:indexPath];
426 XCTAssertEqual(node.numberOfLayoutsOnMainThread, 1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
427 XCTAssertEqual(node.constrainedSizeForCalculatedLayout.max.width, newSize.width);
428 }

@nguyenhuy
Copy link
Contributor Author

Ok, I will recheck everything here. Thanks for the heads up :)

@appleguy
Copy link
Contributor

If it’s late wherever you are, don’t rush! I need to write the release notes anyway, which I won’t have done for approximately 24hrs anyway.

    — Scott

On Oct 25, 2015, at 9:35 PM, Huy Nguyen notifications@github.com wrote:

Ok, I will recheck everything here. Thanks for the heads up :)


Reply to this email directly or view it on GitHub #753 (comment).

@nguyenhuy
Copy link
Contributor Author

It's early morning over here. But yeah, shouldn't rush this thing. Thanks.

- After node constrained sizes were changed (because the table view width was changed, for example) and before relayoutAllNodes is executed (on main), if there is any layout tasks being executed on background, the new sizes will be used immediately. Therefore, by the time relayoutAllNodes is performed, some nodes already have an up-to-date layout and don't need to remeasure.
- As a result, after relayoutAllNodes is completed, the number of layout passes performed on main thread for each node increased between 0 and 1 (i.e some nodes were remeasured, others weren't). ASTableViewTests is updated to assert this behaviour.
- Injection can be done via a new internal initializer. The class will be used by ASTableView to create (and configure) a new data controller.
- ASTableViewTests now injects its own type of ASDataController. This facilitates new ways for testing ASTableView-specific behaviours. The first application is counting the number of times relayoutAllNodes is called on the data controller.
@nguyenhuy nguyenhuy force-pushed the DataControllerSortedTransaction branch from fd732cd to 72fca53 Compare October 26, 2015 11:54
@nguyenhuy
Copy link
Contributor Author

@appleguy You are right, Travis does merge the branch with master and run the tests on top of the merge commit. I just had a hard time believing the tests were still failing and desperately looked for someone to blame. How silly I am! But I think I found out the root cause and fixed it. All checks have passed 👏

appleguy added a commit that referenced this pull request Oct 26, 2015
Sort edit commands during batch updating of table and collection views
@appleguy appleguy merged commit 2c8626e into facebookarchive:master Oct 26, 2015
@appleguy
Copy link
Contributor

This may be one of the most satisfying-to-click Merge buttons I've done for ASDK :). ASDataController has really gone from the Achilles heel of the framework to one of its most capable and unique components.

@nguyenhuy nguyenhuy deleted the DataControllerSortedTransaction branch October 26, 2015 21:24
aimalygin pushed a commit to aimalygin/AsyncDisplayKit that referenced this pull request Feb 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants