No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Vuex HMR setup problem

    Help
    2
    4
    135
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • NikitaKA
      NikitaKA last edited by

      Hi!

      I stuck trying to setup Vuex to work with HMR.

      I just created new project from scratch by quasar create. After that, in store/index.js, few lines from documentation added:

      if (process.env.DEV && module.hot) {
        module.hot.accept(['./module-example'], () => {
          const newExample = require('./module-example').default
          Store.hotUpdate({ modules: { example: newExample } })
        })
      }
      

      But every time I update module files - nothing is happening (according to Vue DevTools). Store don’t updating. Only if I kill Quasar process in terminal and restart it.

      What am I doing wrong?

      P.S. No errors, HMR is working fine with SFC.

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        You shouldn’t need to add anything to get HMR with Vuex in a Quasar project. Did you add that code to the store/index.js file?

        Scott

        1 Reply Last reply Reply Quote 0
        • NikitaKA
          NikitaKA last edited by

          Yup. I just removed that code and now store is updating after I close DevTools and open it again. Is that normal behavior? Maybe it’s DevTools issue…

          1 Reply Last reply Reply Quote 0
          • NikitaKA
            NikitaKA last edited by

            I was wrong when expected Store state to be updated with HMR - this shouldn’t have happened. I was confused because even when I just refreshing a tab - store kept its old state. I tried to work with getters, actions, etc. and it seemed works fine. Thanks 😃

            1 Reply Last reply Reply Quote 0
            • First post
              Last post