First of all, I would appreciate your understanding of my poor English. I wonder if Vuex's store data always resides in memory.
Let me explain with an example. When entering page A, we received a list from the server and implemented it to be stored on the store. Does this mean that when I enter page A and move to page B, the list of A will remain in memory even though it is not used?
Doesn't this cause memory overflow in very large applications?
Vuex is a library that stores data in a Vuex store, which acts as the source of data on states in a Vue application. This store contains a global state (set of properties) and functions (getters, actions and mutations) used to read and alter the state.
A Typescript-ready Vuex plugin that enables you to save the state of your app to a persisted storage like Cookies or localStorage.
In Redux state is always immutable, while in Vuex committing mutation by the store is the only way to change data.
The entire page state (including the DOM and Javascript/Vuex data) will remain in memory provided that a full page reload did not occur (which would be the case if you're using vue-router). This is called a Single Page Application (SPA).
In a SPA, you need to ensure that you drop any references (e.g. set to null
) to large objects and arrays when they are no longer needed so that the memory can be freed by the garbage collector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With