Bug with old element recycling (V1)
See original GitHub issueI found this problem with V1, and I’m reporting it in case it remains relevant for V2.
The problem is that the old-body recycling seems to presume the body is not null, when it sometimes is. The fault is in this code:
function findDonor(node, newParent, oldParent, fromIdx, toIdx) {
var newIsView = u.isArr(node);
var newKey = newIsView ? getViewKey(node[1], node[2]) : node.key;
var oldKeys = oldParent.hasKeys;
var newKeys = newParent.hasKeys;
var oldBody = oldParent.body;
var newBody = newParent.body;
// fast exact match by key
if (newKey !== null && oldKeys) {
var idx = u.keyedIdx(newKey, oldBody, newIsView ? node[0] : null, fromIdx, toIdx);
if (idx > -1)
return [idx, DONOR_NODE];
return null;
}
// if from or to > newbody length, return null
// todo: from keys here
fromIdx = fromIdx || 0;
if (fromIdx > oldBody.length - 1) return null;
// ^^^ repeatedly and consistently get oldBody is null or oldBody.length is null here
toIdx = toIdx === 0 ? 0 : toIdx || oldBody.length - 1;
...
To resolve it, I simply changed the marked line to:
if (!oldBody || fromIdx > oldBody.length - 1) return null;
Unexpected is that the error varies between oldBody
and oldBody.length
.
Note that to produce a replication would require considerable time and effort since the displays are complex and would need to be (tediously) whittled down to the simplest form that reproduces the error. I don’t know if it’s worth investing the effort to do that, yet.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Dismantling of Printed Circuit Boards Enabling Electronic ...
Conventional recycling involves manual removal of high value electronic components (ECs), followed by raw crushing of. WPCBs, to recover main ...
Read more >Element Metal Recycling is Omaha's premier recycling ...
402-999-1894 · 2625 Deer Park Blvd., Omaha, NE 68105 · 8:30 a.m. – 4:30 p.m. Monday – Friday · 8:30 a.m. – 11:30...
Read more >Lifecycle methods - Mithril
Recycling an element avoids incurring the performance cost of recreating ... This hook is only called if the element existed in the previous...
Read more >NEWS
data.table v1.13.6 (30 Dec 2020). BUG FIXES. Grouping could throw an error Failed to allocate counts or TMP with more than 1e9 rows...
Read more >You Asked! Recycling Answers Revealed, V1 - Go All In
Q: Can I still recycle pop and beer cartons? A: Yes! The slick-coated cartons used to package pop and beer go into your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@leeoniya
Yes, very much so. But I have to deliver the initial release over for QA first. So far the only complication that may take a little time to work through is my post-generation augmentation of the primary view based on host data which incorporates addressing into and searching the display grid. The rest I expect to be basic grunt work.
I expect to get to V2 before the end of this month.
sure, go for it