RowMeta index becomes stale when a row is prepended
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 351
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 1
Description
Thanks for all the great work on this -- abstracting flexible tables ain't easy.
Currently, the rowMeta.index property is only updated whenever a node is accessed.
objectAt(index) {
// ...
// Set the perceived index on the meta. It should be safe to do this here, since
// the row will always be retrieved via `objectAt` before being used.
set(meta, 'index', index);
return result;
}
This seems sufficient for most cases. However, it doesn't cover scenarios where a row is prepended (or, actually, any non-append operation). Because it shifts the indexes for subsequent rows with no change to the row objects. So there is usually no need to retrieve the row.
My specific use case is rendering row numbers from rowMeta.index. The workaround is to force object retrieval by binding to rows.length and re-rendering the relevant template section.
On Friday, I'm hoping to look into this a bit more and possibly come up with a solution. So any direction you can give would be much appreciated.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in addon/-private/collapse-tree.js at objectAt, where rowMeta.index is assigned. Reproduce a prepend or other non-append row update and inspect how existing row objects retain their indexes. Done means rowMeta.index reflects shifted positions when row numbers render, without relying on forced object retrieval.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100