vertical-collection icon indicating copy to clipboard operation
vertical-collection copied to clipboard

shouldRecycle=false breaks UI when scrolling the elements fast.

Open ahamedalthaf opened this issue 5 years ago • 9 comments

'shouldRecycle: false' is breaking the UI when we try to scroll faster. This breaks the UI and completely block the user from doing any activity.

Version: "@html-next/vertical-collection": "1.0.0-beta.12"

Please find the error below in the browser console.

Assertion Failed: value must non-negative

ahamedalthaf avatar Sep 05 '19 13:09 ahamedalthaf

@ahamedalthaf can you try the latest version please?

RobbieTheWagner avatar Sep 05 '19 14:09 RobbieTheWagner

@rwwagner90 tried with latest version and still seeing the same issue.

ahamedalthaf avatar Sep 05 '19 15:09 ahamedalthaf

I'm experiencing this on emberclear, too :(

I enabled shouldRecycle='false' because without it the item's did-insert modifier/hook isn't reused... which is problematic :man_shrugging:

NullVoxPopuli avatar Sep 07 '19 02:09 NullVoxPopuli

@rwwagner90 I have fixed this issue in the PR raised. Please check from your side.

ahamedalthaf avatar Sep 21 '19 17:09 ahamedalthaf

Thanks @ahamedalthaf!

RobbieTheWagner avatar Sep 21 '19 19:09 RobbieTheWagner

Was seeing nextSibling of undefined in the glimmer vm with this flag as well.

knownasilya avatar Dec 17 '20 17:12 knownasilya

While the referenced PR has been merged for some time (looks like it would have landed in 3.0.0), I'm encountering a similar error in newer versions.

I've tested in both 4.0.1 and 3.1.0, both versions result in a similar error, the below report is from 4.0.1 (latest at time of writing):

Uncaught Error: Assertion Failed: value must non-negative
    at Object.assert (index.js:181:1)
    at SkipList.set (-private.js:1486:1)
    at DynamicRadar._measure (-private.js:1762:1)
    at DynamicRadar._updateIndexes (-private.js:1656:1)
    at DynamicRadar.update (-private.js:782:1)
    at -private.js:769:1
    at Array.execJob (index.js:36:1)
    at Scheduler.flush (index.js:96:1)
    at index.js:82:1

I'll try and follow-up with more details as I begin to investigate...

jbottigliero avatar Dec 15 '22 18:12 jbottigliero

Anyone got an idea how to fix this? We have the same reason as @NullVoxPopuli to use shouldRecycle={{false}}

wozny1989 avatar Jul 25 '23 14:07 wozny1989

since I posted my comment, I've found that using derived data for everything solves most problems.

did-insert/did-update/will-destroy are problematic for more than just this scenario, but also outside of Ember. useEffect in React suffers from the same problem, as do other effect implementations in other frameworks, such as Preact, Solid, etc.

By using derived data, you appropriately get the correct behavior when you need it (when the root state changes, which is what happens during component re-use)

NullVoxPopuli avatar Jul 27 '23 16:07 NullVoxPopuli