{"id":8174,"date":"2023-06-23T12:24:23","date_gmt":"2023-06-23T12:24:23","guid":{"rendered":"https:\/\/www.bacancytechnology.com\/qanda\/?p=8174"},"modified":"2023-08-03T05:26:11","modified_gmt":"2023-08-03T05:26:11","slug":"vuejs-dev-tools","status":"publish","type":"post","link":"https:\/\/www.bacancytechnology.com\/qanda\/vue\/vuejs-dev-tools","title":{"rendered":"How to Record Mutation and Action in &#8220;Vue JS Dev Tools&#8221; Beta Version?"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone size-large wp-image-8175\" src=\"https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1024x371.png\" alt=\"Timeline Option\" width=\"1024\" height=\"371\" srcset=\"https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1024x371.png 1024w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-300x109.png 300w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-768x278.png 768w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1536x556.png 1536w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option.png 1919w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>As shown in the above image, Vue devtools provides Timeline options from where we can keep record of mutation and actions.<\/p>\n<p>For the demo purpose, I have created a functionality to increment counter using Vuex.<\/p>\n<p>Here is the code of <strong>Store.js:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import { createStore } from \"vuex\";\r\n\r\n\r\nconst store = createStore({\r\n    state() {\r\n        return {\r\n            counter: 0\r\n        }\r\n    },\r\n    mutations: {\r\n        incrementMutation(state) {\r\n            state.counter++;\r\n        }\r\n    },\r\n    actions: {\r\n        incrementAction({commit}) {\r\n            commit('incrementMutation');\r\n        }\r\n    },\r\n    getters: {\r\n        counter(state) {\r\n            return state.counter;\r\n        }\r\n    }\r\n});\r\n\r\n\r\nexport default store;<\/pre>\n<p>Code of <b>App.vue<\/b> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;template&gt;\r\n  &lt;div&gt;{{ counter }}&lt;\/div&gt;\r\n  &lt;button @click=\"increment\"&gt;Increment&lt;\/button&gt;\r\n&lt;\/template&gt;\r\n\r\n\r\n&lt;script&gt;\r\nexport default {\r\n  name: 'App',\r\n  methods: {\r\n    increment() {\r\n      this.$store.dispatch('incrementAction');\r\n    }\r\n  },\r\n  computed: {\r\n    counter() {\r\n      return this.$store.getters['counter'];\r\n    }\r\n  }\r\n}\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>So, when we click on the increment button, as shown in the below images we will be able to see the record of action and mutation with the timestamp.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-large wp-image-8179\" src=\"https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1-1024x516.png\" alt=\"Timeline Option 1\" width=\"1024\" height=\"516\" srcset=\"https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1-1024x516.png 1024w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1-300x151.png 300w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1-768x387.png 768w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1-1536x774.png 1536w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-1.png 1919w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-large wp-image-8180\" src=\"https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-2-1024x423.png\" alt=\"Timeline Option 1\" width=\"1024\" height=\"423\" srcset=\"https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-2-1024x423.png 1024w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-2-300x124.png 300w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-2-768x317.png 768w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-2-1536x635.png 1536w, https:\/\/www.bacancytechnology.com\/qanda\/wp-content\/uploads\/2023\/06\/Timeline-Option-2.png 1914w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>So, From the timeline option, We can easily debug the flow of Vuex store in our Vue application and also track the changes of state based on execution of the mutation and actions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As shown in the above image, Vue devtools provides Timeline options from where we can keep record of mutation and actions. For the demo purpose, I have created a functionality to increment counter using Vuex. Here is the code of Store.js: import { createStore } from &#8220;vuex&#8221;; const store = createStore({ state() { return { [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8461,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[13],"tags":[],"class_list":["post-8174","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vue"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/8174"}],"collection":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/comments?post=8174"}],"version-history":[{"count":4,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/8174\/revisions"}],"predecessor-version":[{"id":8266,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/8174\/revisions\/8266"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media\/8461"}],"wp:attachment":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media?parent=8174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/categories?post=8174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/tags?post=8174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}