A
A
Alexey Sklyarov2018-12-04 16:58:07
Vue.js
Alexey Sklyarov, 2018-12-04 16:58:07

How to properly disable dynamic data change in the component if the route has changed?

There is a component A , in which a store-action is executed through setInterval. In this action, a request is made to the api and the data is placed in the storage. When I navigate to a page /page/ that doesn't have an A component , it still shows that setInterval is attempting to update the store. Although the component itself is not on the page. I read about fixing memory leaks, it describes keep-alive, but I'm not sure if it suits me at all.
When and how to correctly remove all setInterval, apply destroy methods to plugins, etc.?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-12-04
@0example

Well, since the data must be updated when the component is present, disable the update in its beforeDestroy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question