Vuex: Add ability to unload dynamic modules

Created on 15 Jul 2016  路  4Comments  路  Source: vuejs/vuex

Dynamic registration of modules is a crucial feature that was lacking in vuex 1.0. However, shouldn't there be a way to remove modules when you're done with them? The dynamic modules will just keep piling up in the store, with no way to remove them.

enhancement

All 4 comments

was wondering the same

First, that's not what I would all a "memory leak" -there's no additional memory being blocked over and over when calling the same function or sth. of that nature.

If you work with huge amounts of data in a module and worry about them hogging memory, you can simply whipe the module's state to a clean slate with a RESET mutation. all that will be left then will be the mutations/actions/getters, which even for a big module hardly leave a print in memory.

With the above, I don't see a need to make modules remove-able, but we can discuss it as a feature proposal.

Could you re-name the issue to something more fitting, e.g. "Make dynamic modules unload-able" or something? Thanks.

We're not talking about storing huge amounts of a data in module. We're talking about even a module with a lot of data, but which could be created several time over the lifespan of your app.
In my particular instance, I have a widget which creates a new module every time it is created. The new module is namespaced based in the component's uid, so the store get's cluttered with these.

I guess it's technically not a "memory leak", at least not any more then a redux immutable store is (as in a datastructure which is "append only" for the lifetime of the app, although I think it definitely makes sense to be able to clean that up.

Now supported in 2.0.0-rc.4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthewmorgan picture matthewmorgan  路  3Comments

gorbypark picture gorbypark  路  3Comments

weepy picture weepy  路  3Comments

niallobrien picture niallobrien  路  3Comments

gdelazzari picture gdelazzari  路  3Comments