Using $dispose to save memory in big applications #3048
              
                Unanswered
              
          
                  
                    
                      Seanitzel
                    
                  
                
                  asked this question in
                Help and Questions
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
First I want to say I love Pinia, it's the best state management library i've ever used(and I've used a handful).
I use it in a pretty big monorepo of packages and Nuxt layers, all of these are used in a superapp.
I have over 25+ different stores, and the memory foot print keeps growing when using the different features of the app.
Most of the stores are feature-specific, and I don't need store X to be reactive when the user is not inside feature X.
I saw the $dispose method in the API, but I didn't really see any docs about it - so I thought i'd ask here just to make sure I don't miss anything.
Is it ok to $dispose store X e.g on the unmounted hook of a pag, and it will automatically become reactive again when I go to a page that uses that store and calls useStoreX on the setup function of that feature?
Beta Was this translation helpful? Give feedback.
All reactions