Skip to content

Expand/collapse icon rendering immediately when adding subdeck #18279

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gayatriii0803
Copy link
Contributor

@gayatriii0803 gayatriii0803 commented May 5, 2025

Purpose / Description

Expand/collapse icon was not updating immediately after adding a subdeck

Fixes

Approach

Added oldItem.children.isEmpty() == newItem.children.isEmpty() to areContentsTheSame() in DiffUtil.ItemCallback to correctly reflect changes in child deck presence.

How Has This Been Tested?

Emulator

WhatsApp.Video.2025-05-05.at.21.51.52_ef7d4075.mp4

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • [] UI Changes: You have tested your change using the Google Accessibility Scanner

Sorry, something went wrong.

Arthur-Milchior
Arthur-Milchior previously approved these changes May 8, 2025
Copy link
Member

@Arthur-Milchior Arthur-Milchior left a comment

Choose a reason for hiding this comment

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

Please remove the two new files. They are not needed.
Generally, it's nice if you take a look at the "files changed" on PR you open. That's the kind of surprise that occurs all of the time.

Appart from that, very good.

Note to reviewers: don't merge until the two log files are removed.

Copy link
Member

@Arthur-Milchior Arthur-Milchior left a comment

Choose a reason for hiding this comment

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

Also, I'd love your commit message to be more than a single line. You could at least reuse your "approach" from your pr description.

But more importantly, it would be to explain why we need to consider whether there are subdecks or not

@@ -276,5 +276,6 @@ private val deckNodeDiffCallback =
oldItem.fullDeckName == newItem.fullDeckName &&
oldItem.newCount == newItem.newCount &&
oldItem.lrnCount == newItem.lrnCount &&
oldItem.revCount == newItem.revCount
oldItem.revCount == newItem.revCount &&
oldItem.children.isEmpty() == newItem.children.isEmpty()
Copy link
Member

Choose a reason for hiding this comment

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

I would not add this as the last element.
If you added it just after did, it would allow you to change a single line instead of two. Also, it would ensure that the things you test are in the order in which they are displayed on screen.
I'd also add a comment stating

We need to know whether there are children in order to know whether we draw the icon on the left

@Arthur-Milchior Arthur-Milchior dismissed their stale review May 8, 2025 03:29

Actually there is still an issue

@Arthur-Milchior
Copy link
Member

Screen_recording_20250508_052856.mp4

Actually, there is still an issue. If you create the first subdeck or if you delete the last subdeck, you'll end up with decks that are not aligned.
This is because, if there is a single subdeck anywhere in the collection, all decks are moved to the right in order to let room for the icon on the left when needed. And in order that even when the icon is not needed, the decks are aligned together

Which means that your state need to record also whether there was a subdeck somewhere in the collection

@lukstbit lukstbit added the Needs Author Reply Waiting for a reply from the original author label May 10, 2025
Copy link
Contributor

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label May 24, 2025
@Arthur-Milchior
Copy link
Member

@gayatriii0803 Eh, can you please let us know whether you plan to update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Has Conflicts Needs Author Reply Waiting for a reply from the original author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand/collapse icon not rendering immediately when adding subdeck
3 participants