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

Events are emitted continuously after instantiation of the vue-typed-js component and navigating away (possible leak scenario) #29

Open
pratyushtewari opened this issue Jan 22, 2020 · 3 comments

Comments

@pratyushtewari
Copy link

pratyushtewari commented Jan 22, 2020

I am nost sure if this is an issue of default behavior of vue/nuxt

I am using vue-typed-js on one of the pages in my nuxt website, and even when I navigate away from the page where I used this component, I see a lot of events continuously emitted by this package. Is that suppose to happen?

Screen Shot 2020-01-21 at 9 34 04 PM

These events were being emitted even when I only opened the home page.

My setup is as follows:

I added a file calledplugins/vue-typed-js.js

import Vue from 'vue';
import VueTypedJs from 'vue-typed-js';

Vue.use(VueTypedJs);

and in nuxt.config.js file I have

plugins: [
  {src: '@/plugins/vue-typed-js.js'},
]

I have this component being used in a page deep inside the route http://localhost:3000/projects/testProject and I can see the events even when I open the index.html at the root http://localhost:3000/ after I have opened the project page.

Is there any special way to destroy the component after navigating away?

@pratyushtewari pratyushtewari changed the title Events are emitted continuously without instantiation of the vue-typed-js component Events are emitted continuously after instantiation of the vue-typed-js component and navigating away (possible leak scenario) Jan 22, 2020
@pratyushtewari
Copy link
Author

it feels like the teardown is not happening.

Even if I call destroy in the parent element, the events are still emitting.
in parent I called

  beforeDestroy() {
      console.log("destroying vue-typed-js");
      this.$children[0].$destroy();
  },

I checked the there was only 1 child component in this parent and it was vue-typed-js.

@isaacjoy
Copy link

isaacjoy commented Mar 3, 2020

I'm also having problems with events being fired properly using nuxt: #31

@jzstern
Copy link

jzstern commented Mar 20, 2020

Not using nuxt but observing the same problem.

Events are firing as if a <vue-typed-js> component exists, when really I'm destroying the element by passing a falsey value into the v-if. I've also tried wrapping the <vue-typed-js> component in a <div>, but I still see the same events fire.

I love this library & use typed.js quite a bit, but it's causing a lot of unnecessary events :P

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

No branches or pull requests

3 participants