Attempted to remove an unattached handler
vyobukhov opened this issue · 8 comments
Hello,
I have two vertical collections on routes: /dialogs and /dialog/:id. The first one contains list of dialogs and the other one contains list of messages in this dialog.
Code of the first one (/dialogs):
{{#vertical-collection content=model defaultHeight=100 alwaysUseDefaultHeight=true useContentProxy=false as |item index| }} {{c-dialog model=item open="open"}} {{/vertical-collection}}
Code of the second one (/dialog/:id):
{{#vertical-collection content=messages defaultHeight=30 alwaysRemeasure=true renderFromLast=true as |item index| }} {{c-dialog-message model=item}} {{/vertical-collection}}
When I'm trying to go back from messages to dialogs (/dialogs => /dialog/1 => /dialogs) list I'm getting this error "Attempted to remove an unattached handler"
But when I'm navigating through one more route (for example /dialogs => /dialog/1 => /profile => /dialogs) everything works fine.
Is it bug? Or I'm doing something wrong?
I've got a similar/same issue with two vertical-collections
on one page. Doesn't seem to happen if only one is rendered at once.
For me it only happens if one of the tables is destroyed. We are setting a containerSelector
which was the same for all tables but it doesn't seems to be related to this.
Debugging flow
_teardownHandlers()
calls removeScrollHandler(this.telescope, this._scrollHandler) first without errors_teardownHandlers()
calls removeScrollHandler(Container, this._scrollAdjuster)- elementCache is
{top: 0, left: 0, handlers: Array[0]}
- shouldn't it have at least on adjust handler? - leads to the error itself
@vyobukhov maybe you can check if the debugger flow is the same for you. Given error is triggered in two different cases here and here
@runspired I'm not sure how to dig deeper?
does it seem like it would be viable to return inside returnElementHandler
if the length of the handlers is 0. This would prevent this breaking error - and it doesn't seem like it would leave any handlers orphaned.
@kylemellander - yes that would fix error - but wondering @runspired's thoughts on GC perf issues - do the listeners still hold a reference that the browser engine will have to run GC cycles for? Or did ember tear them down already for us?
(have not read lib code at all, fyi) - but looking at options for new client's app that needs mobile infinite scroll - so might in future if this project seems active enough
I got the same error. I use smoke-and-mirrors version 0.6.2.But I can't. How to solve?
+1
I'm seeing this error when running my acceptance test, it breaks all my tests afterwards. Would really appreciate some help on how to fix it.
Error: Attempted to remove an unattached handler
the repo moved, try upgrading and use https://github.com/html-next/vertical-collection
Should be fixed by updating to @html-next/vertical-collection
(now re-exported by this lib)