question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add subitem doesn't account for other expanded subitems

See original GitHub issue

In our latest round of testing we’ve found another small bug with regard to adding subitems. Additions work well except in the case that the incoming item is being placed after another subitem that itself is expanded. In this case, the position does not account for the additional flat list positions occupied by the children and the incoming item is placed either between the sub-subitems or in another incorrect position of the list.

I’ve tracked the relevant code down to the following:

Jump to code in GitHub

private boolean addSubItems(@IntRange(from = 0L) int parentPosition, @IntRange(from = 0L) int subPosition, @NonNull IExpandable parent, @NonNull List<T> subItems, boolean expandParent, @Nullable Object payload) {
        boolean added = false;
        if(expandParent && !parent.isExpanded()) {
            this.expand(parentPosition);
        }

        if(parent.isExpanded()) {
            added = this.addItems(**parentPosition + 1 + Math.max(0, subPosition)**, subItems);
        }

        if(payload != null) {
            this.notifyItemChanged(parentPosition, payload);
        }

        return added;
}

A similar issue occurs when an expandable item H is expanded followed by the expansion of a subitem and then the collapse of the top expandable item H. The collapse only removes k items where k = the number of direct subitems for the expandable item H. A method to quickly return the total number of visible subitems (recursively counting expansions when present) seems most useful to help handle these cases. Does such a method exist? Perhaps I missed it? If not, I’m happy to try my hand at a version but the modifications will be more significant than my last effort and I appreciate your input with regards to other areas where issues may arise due to this bug.

Thanks!

P.S. I can submit the expansion count bug as a separate issue or append it here if you prefer since they are similar.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
gwailoTr0n5000commented, Jun 27, 2017

Figured it out, was using a recursive call in prepareItemsForUpdate that is unnecessary as that method already traverses through subitems as they expand. Pull request being sent now.

0reactions
gwailoTr0n5000commented, Jun 30, 2017

Excellent! That was something we were considering for the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The subitems - monday.com Support
You can add subitems onto your board through the following ways: Right-clicking on the item name and selecting "Add subitem":.
Read more >
Quick Tip - Remove Subitem Column - YouTube
You can no longer delete the Subitem column from your monday.com boards... Here are 3 solutions!Monday Man Links Create Make account : ...
Read more >
How to do Subitem Rollup monday.com - YouTube
Want to see your subitems in main board? Here is how you mirror up your subitems in monday.com. Follow Omnitas and this playlist...
Read more >
Subitems - Infinity
Another way to convert your subitems to items is by simply drag and dropping a subitem in Table view and List view somewhere...
Read more >
Custom Link/Page(sub item)/Page(sub item) Issue
Works fine if I only use one level of sub items… Can a “Custom Link” support a sub-item with an additional sub item?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found