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

Reverting paging3 migration #14968

Merged
merged 4 commits into from
Jul 1, 2021
Merged

Conversation

develric
Copy link
Contributor

@develric develric commented Jul 1, 2021

This cherry pick changes from #14949 as an hotfix for 17.6

NOTE: code that was cherry picked from 17.7 was slightly ahead respect the original code in 17.6. This required adding the UnifiedCommentListItemDecoration that was added in 17.7. All this code is behind a feature flag, so as far as it compiles and we confirm the fix works we should be ok.

Reporting below the description from the original PR for convenience.

Fixes #14860

Migration to Paging 3 is causing some issues with Post List. We need a bit more for a partial or full migration to Paging 3.

This PR removes the Paging 3 dependency and comments out the code that is using it, since it's behind the feature flag.

To test:

  • Make sure that the app builds without any issue.
  • Go to the post list and scroll down quickly
  • Notice that post loading is performed correctly, the list remains visible and nothing crashes.

Regression Notes

  1. Potential unintended areas of impact
    We are removing the offending library so should be none.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)

  3. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

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

Left a few questions while comparing the diff with the other PR.

Note that I'm no Android developer and only blindly compared the diff with other PR, or compared what was removed with what was commented, without trying to decipher the Android logic behind it, so those are merely questions and incentives to double-check, but might be false positives.

Even if there are differences in the two diffs that are correct and make sense because develop and release/17.6 differ, I think it would still be valuable to ensure the code that is marked as +added but commented out matches the code that is marked as -removed in the diff, otherwise this will lead to regressions when we uncomment them later.

return commentListItems
}
/**
* Temporarily commented out until migration between Paging 2 and 3 is sorted out.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: worth a reference to the Slack discussion, Sentry issue, and past PRs here to track it when we get back to it? 🤔

Comment on lines +66 to +69
override fun onDestroyView() {
super.onDestroyView()
binding = null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this part being added in the diff of the cherry-picked commit – https://github.com/wordpress-mobile/WordPress-Android/pull/14949/files#diff-d3f669617284dbfa52ea7b4aeb770607c0f206258a309d4140a8a417153a1b02L65, but I see it was already there back then tho.
Just double-checking this re-addition is thus intentional given this was not part of the release/17.6 branch when we did 17.6 back then.

Comment on lines -27 to -52
val commentListItems = commentListItemPager.flow
.map { pagingData ->
pagingData.map { commentModel ->
val toggleAction = ToggleAction(commentModel.remoteCommentId, this::clickItem)
val clickAction = ClickAction(commentModel.remoteCommentId, this::toggleItem)
Comment(
remoteCommentId = commentModel.remoteCommentId,
postTitle = commentModel.postTitle,
authorName = commentModel.authorName,
authorEmail = commentModel.authorEmail,
body = commentModel.content,
avatarUrl = "",
isPending = commentModel.status == CommentStatus.UNAPPROVED.toString(),
isSelected = false,
clickAction = clickAction,
toggleAction = toggleAction
)
}
.insertSeparators { before, after ->
when {
before == null -> SubHeader("Date Sub Header", -1)
// TODO add the logic for determining if subheader is necessary or not
else -> null
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Side note that the diff is slightly different here from what was removed in the other PR. Probably expected given this part of the code like changed between release and develop, but just wanted to highlight this to double-check that the different code being removed did not have side effects that the original didn't have.

Also, that means that the code that is actually added and commented out on the following lines 18-73 does not match what was removed, so when we get back to this later to "revert this revert" and try to get back to migrating to paging 3, there is a risk that we would just uncomment the lines 18-73 (instead of reverting this PR) and land in a different state of the code that what was expected, introducing regressions and bugs or behavior changes that were fixed by the new code that was removed above but were still present in the code that was commented below

@@ -0,0 +1,90 @@
package org.wordpress.android.ui.comments.unified
Copy link
Contributor

Choose a reason for hiding this comment

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

This whole file was not part of the other PR. Is this file addition expected there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as mentioned in the PR description

NOTE: code that was cherry picked from 17.7 was slightly ahead respect the original code in 17.6. This required adding the UnifiedCommentListItemDecoration that was added in 17.7. All this code is behind a feature flag, so as far as it compiles and we confirm the fix works we should be ok.

being the code behind a feature flag AFAIU if it compiles it should not have an impact since it is not run and we removed the dependency on the paging 3 lib (happy to have your thoughts on this as well @ashiagr 🙇 )

Copy link
Contributor

Choose a reason for hiding this comment

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

Since it behind a feature flag + there are no compilation issues (and we need the new file after the latest changes since last fix) + no fast scrolling/ refresh issues, so 👍 from me.

@AliSoftware
Copy link
Contributor

Note that the BuildKite CI failure (pipeline-pipeline-upload) is expected, as we didn't have BuildKite configured in the release branch yet back then.

@develric
Copy link
Contributor Author

develric commented Jul 1, 2021

hey @AliSoftware 👋 , was reading your notes above; let me share my reasoning so we can double-check if it makes sense (and adapt to whatever we decide it's the best approach 🙇 ; cc @ashiagr for another opinion as well)

  • As you said code evolved a bit from 17.6 to 17.7
  • my intention was to cherry pick the original fix PR changes only adding minimal changes to the 17.6 to allow building the cherry picked changes (this for example is the case for adding UnifiedCommentListItemDecoration
  • All the code changes above are behind a feature flag so as far as it compiles (and we removed the dependency on paging 3) the code should not be run at all
  • as for the conflicts when coming back to develop; I think it's something we will need to deal with when bringing back the code to develop after the hotfix. In my understanding the code we cherry picked above will be aligned with develop and we will merge the code under the comments.unified package probably just accepting the develop version (but @khaykov will know more about it)

Does the above makes sense? (especially the last point).

Another possibility is to manual comment out the not needed code instead of cherry picking from the original fix

@AliSoftware
Copy link
Contributor

as for the conflicts when coming back to develop; I think it's something we will need to deal with when bringing back the code to develop after the hotfix. In my understanding the code we cherry picked above will be aligned with develop and we will merge the code under the comments.unified package probably just accepting the develop version (but @khaykov will know more about it)

Actually, after taking my late morning coffee, I realized I was wrong with my suggestion above: the code that is added but commented out in this PR's diff should match what's in develop, as opposed to match what was removed in this PR, because as you said once this hotfix lands and is merged back into develop, we want the commented-out code to match what's already in develop 🙂 (And in fact if we applied my incorrect suggestion, that would lead to conflicts and could be what would risk causing regressions later when we uncomment it as it wouldn't match develop)

So nevermind, sorry for the misleading suggestion, and you were correct in your changes made then 👍 As long as the commented code added matches the commented code in develop we should be good 🙂

Copy link
Contributor

@ashiagr ashiagr left a comment

Choose a reason for hiding this comment

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

Thanks for a fast turnaround @develric. I tested the PR according to the testing steps and could not reproduce the crash. Comments load fine as well after removing the feature flag.

I agree with your reasoning in #14968 (comment), 👍 from me.

@develric develric marked this pull request as ready for review July 1, 2021 10:27
@peril-wordpress-mobile
Copy link

You can test the changes on this Pull Request by downloading the APKs:

@develric develric merged commit 3f08c96 into release/17.6.1 Jul 1, 2021
@develric develric deleted the fix/reverting-paging3-migration branch July 1, 2021 10:50
@peril-wordpress-mobile
Copy link

Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

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.

4 participants