block / block/thread-manager-for-amp
Organization of Table view
- Dominant language
- TypeScript
- Stars
- 6
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Putting this here as food for thought, I don't love the organization of the table view...but I also couldn't think immediately of how to fix it.
```
Given:
root(Jan 1) → branch-a(Jan 2) → leaf-a(Jan 4)
→ branch-b(Jan 3) → leaf-b(Jan 5)
buildThreadStacks() collects all 5 into one group, sorts by date descending, losing the branching nuance. You can't tell that leaf-a came from branch-a and leaf-b came from branch-b. It just looks like a flat timeline.
```
AMP suggested some wonky fixes for this:
```
Option A: Tree under head, root-up with indentation
Keep head as the top row. Expand shows the tree starting from root, walking down. The head is excluded from the tree (it's already the main row). This is chronological and shows fork structure, but reads "opposite" from the rest of the list.
leaf-b (Jan 5) ← head row (collapsed shows this)
root (Jan 1) ← expand starts here
├── branch-a (Jan 2)
│ └── leaf-a (Jan 4)
└── branch-b (Jan 3)
└── ● head ← marker showing where "you are"
My suggestion: Option A. It's what ThreadChainContent.tsx already does for the chain panel (root-down tree with indentation and fork icons). The head row stays at the top as the "entry point," and the expanded tree below it gives you the full picture. Users reading the tree will naturally scan top-to-bottom chronologically.
```
My idea is more:
```
Show the root as the stable "identity" of the stack, but sort it by the most recent activity across any member.
root (Jan 1) [5 threads · active Jan 5] ← sorted by Jan 5 position
├── branch-a (Jan 2)
│ └── leaf-a (Jan 4)
└── branch-b (Jan 3)
└── leaf-b (Jan 5)
This is better than the current approach because:
Stable identity: the root doesn't change as new children are added
Natural tree: expands root-down, which reads correctly
Correct sort: active stacks still float to the top
No confusion: "ancestors" naming becomes accurate (everything below root is a descendant)
The changes in buildThreadStacks() would be:
Instead of head = chainMembers.sort(byDate)[0], find the member with no parent in the stack (the root)
Add a lastActive timestamp to ThreadStack from the most recent member, so the list can sort by it
ancestors gets renamed to something like descendants or members, and is ordered by the tree walk instead of flat date sort
The one subtlety: threads arrives pre-sorted by the caller. Currently the entry's position in the output mirrors where the first (most recent) member appears in the input. With Option D, we'd need to either re-sort entries by stack.lastActive, or ensure the entry inherits the sort position of its most recent member.
```
Thoughts / feelings welcome
Contributor guide
Assessment
This issue has not been assessed yet.