Skip to content
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

Destroyed hook not called. #339

Closed
GuillaumeLeclerc opened this issue Jan 19, 2016 · 17 comments
Closed

Destroyed hook not called. #339

GuillaumeLeclerc opened this issue Jan 19, 2016 · 17 comments
Labels

Comments

@GuillaumeLeclerc
Copy link

Hello,

I have a component (fragment) and the beforeDestroy hook is called but not the destroyed one. Is it normal or is it a bug ?

Here is a repro: http://jsfiddle.net/xyu276sa/208/

I look at the source code and it seems this part of the code has not been updated for vue 1.0. (it works fine with vue 0.12)

Thank you

@smartpierre
Copy link

I got the same problem here, can someone check on this ?

@yyx990803 yyx990803 added the bug label Jan 19, 2016
@yyx990803
Copy link
Member

Ran the repro but it seems to be working: http://jsfiddle.net/xyu276sa/217/

@yyx990803 yyx990803 added need repro and removed bug labels Jan 20, 2016
@GuillaumeLeclerc
Copy link
Author

Did you checked/unchecked the checkbox multiple times while looking at the console ?. On my computed I only see 'bb' on the console instead of 'bb' (beforeDestroy) and then 'dd' (destroyed).

@smartpierre Can you check my repro and see if it is working on your computer.

@yyx990803 What browser are you running, If you don't see the problem must be browser related.

@yyx990803
Copy link
Member

@GuillaumeLeclerc I did check the checkbox and tested in Chrome, Firefox and Safari, all working as intended.

@GuillaumeLeclerc
Copy link
Author

bug vue

This is what I get when i run the jsfiddle.

I'll try on chrome

EDIT: I have the same output on chrome and firefox. On two different computers (Ubuntu 14.04 and archlinux).

@smartpierre
Copy link

I have the same thing as @GuillaumeLeclerc , it never shows 'dd'

screenshot from 2016-01-20 17 02 30

@GuillaumeLeclerc
Copy link
Author

I thought my computer was going crazy. I'm glad I'm not alone having this strange problem.

@GuillaumeLeclerc
Copy link
Author

I had the chance to test it on a Windows 7. (IE 11 and Firefox 43) and I get the exact same result. I really don't understand how you can get a different result.

I think the bug comes from the differences in the moment when _isBeingDestroyed is set to true.

In vue 1. _isBeingDestroyed is set here, i.e. before the call to _destroye

In vue 0.12 as far as I remember _isBeingDestroyed is set in the _destroy method itself. (I can't point out where it is I'm on my phone and I can't search on github for other branches than master (it seems).

If you can tell me how I can tell which version of vue it is I should be able to make a fix and unit tests for this.

@yyx990803
Copy link
Member

Hmm this is indeed weird. I ran the repro in IE11 & Chrome on Windows 8.1, and IE9 on Windows 7, they are all calling it correctly. Is your Vue version a bit behind? Are you using the latest 1.0.15?

@GuillaumeLeclerc
Copy link
Author

I'm using the one in the jsfiddle. Are you running the js fiddle as is ?

@yyx990803
Copy link
Member

Yes. I'm using this one though because your original one is not working due to rawgithub issues: http://jsfiddle.net/xyu276sa/217/

@smartpierre
Copy link

I tried this one http://jsfiddle.net/xyu276sa/217/ on :

Firefox 43.0.4
Chromium 47.0.2526.73 Ubuntu 14.04 (64-bit)
Chrome Version 47.0.2526.111 (64-bit)

And it only shows 'bb' in the console.

I'm on Ubuntu 14.04

This is actually mind-blowing that on the same jsfiddle we have different results...

@GuillaumeLeclerc
Copy link
Author

Same here but on archlinux windows 7 and Ubuntu 14.04. I tested ie 11, chrome and Firefox

@Gomah
Copy link

Gomah commented Jan 21, 2016

Same here, it's very weird.

If you click on "Go to Foo", check the checkbox & uncheck it, only the 'beforeDestroy' hook is called. ('bb')
But if you check the checkbox & click on "Go to Bar", 'beforeDestroy' & 'destroyed' hooks are called.

@yyx990803
Copy link
Member

@Gomah Ohhhh I think I may have misunderstood what @GuillaumeLeclerc described. Toggling the checkbox does reproduces the issue. Looking into this.

@yyx990803 yyx990803 added bug and removed need repro labels Jan 21, 2016
@GuillaumeLeclerc
Copy link
Author

I thought this was clear enough : Did you checked/unchecked the checkbox multiple times while looking at the console ? but I'm sorry you couldn't understand me, I'm not a native speaker.

@GuillaumeLeclerc
Copy link
Author

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants