-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blaze: Uncaught Error: Must be attached #2981
Comments
I see this periodically. It seems to happen more often on Safari. I don't have a repro, but thought it was worth mentioning so it didn't seem as rare. |
I too am seeing this error. I'll post any updates if I figure out what is happening. |
ok, so, I was just playing around a bit with @mitar 's example. If you put the "click" event first, before the "click button" event, the "Must be attached" error goes away and it seems to function as intended. |
Thanks @mitar, confirming this as a bug. What happens here is:
There is no a single most obvious way to fix them. One of the ways would be to not remove the DOM node until all the event handlers are fired, but that's raises other questions. Another way is to not fire the rest of the event handlers after the DOM node is removed. |
Get this as well. It seems the issue appeared in Meteor 1.1-rc.0 (I was using the Windows Preview before). In my case I don't destroy the same DOM node the event is fired upon, but another one. Because of this, and because I have only one event handler, I don't see how an "outstanding event handlers" could cause the issue. Nevertheless, I followed @Slava's idea number one and solved this by putting my destroying function in a Meteor.defer(). |
I confirm that In my case raising the catchall |
I have a similar issue, but couldn't get the Meteor.defer() to work. Are you able to provide an example please @serkandurusoy? My Template:
My Event listener:
|
@That-David-Guy you could switch the order of |
Tried that as well. Didn't work. |
If I change my li to divs and select it with classes. I don't get the error. |
I experienced similar. |
I am having this issue as well. But I cannot reproduce it reliably which is a huge headache. It happens once in awhile. Basically I have 2 click handlers setup on 2 dom elements attached using Template.events One click handler routes to a new page, the other just toggles a class to open the sidebar. But for some reason, after a hot code push I think, the click handlers break, and when I click the elements it console.log These are simple click handlers yet I get this error once in awhile. Even refreshing the page does not help to fix the click handlers. So a user would just think the entire site is broken even after refreshing the page. You have to actually quit the tab, and then navigate back to the app in a new tab. Then the click handlers work again. This is a problem for me, and a headache since I cannot reproduce reliably. It just shows itself once in-awhile. Any suggestions on what to try? I don't even know how to debug. First of all these are just simple click handlers. I am not removing anything from the dom after clicking them. |
I think I may have solved the core issue which was causing this bug. The problem was in the destroyed callback. Take a look ORIGINAL CODE
NEW CODE
I believe this has solved the issue for me. When the issue arose, typically after making changes to the code and having hot reload the issue still persisted. But after this change, the issue disappeared. |
What is |
it is a meteor easy search component
|
This seems to occur when a template onDestroyed causes an exception? Is it worth investigating whether an onDestroyed (more specific an exception in onDestroyed) can affect other templates and give an |
Hey guys, just to let you know if it can help someone, I had this error when I wanted to delete my list. here is the solution I could manage: Code before:
Just used the if (!this.isSimulation) statement Code working without error:
Hope it can help someone. Cheers |
Could you make a reproduction where this happens regularly? |
You can find the test project from this commit: Let me know if you need anything else. Thanks |
I had a panel with a submit event that had no selector. I added it in the process of converting from SemanticUI to MaterializeCSS. |
This issue has been moved to meteor/blaze#213 - closing here. Thanks! |
See example project. When clicking on "Click Me" button, there is an uncaught Error:
Must be attached
.The text was updated successfully, but these errors were encountered: