From 1c58fccd926586b2303ce41939a535b2044a78a9 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 21 Sep 2022 22:45:11 +0200 Subject: [PATCH] feat: add hot reloading support --- src/stores/labels.ts | 7 ++++++- src/stores/lists.ts | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/stores/labels.ts b/src/stores/labels.ts index 8d2a8f5a..ff43cb35 100644 --- a/src/stores/labels.ts +++ b/src/stores/labels.ts @@ -1,4 +1,4 @@ -import { defineStore } from 'pinia' +import { acceptHMRUpdate, defineStore } from 'pinia' import LabelService from '@/services/label' import {success} from '@/message' @@ -134,3 +134,8 @@ export const useLabelStore = defineStore('label', { }, }, }) + +// support hot reloading +if (import.meta.hot) { + import.meta.hot.accept(acceptHMRUpdate(useLabelStore, import.meta.hot)) +} \ No newline at end of file diff --git a/src/stores/lists.ts b/src/stores/lists.ts index b12923cd..36f7b96b 100644 --- a/src/stores/lists.ts +++ b/src/stores/lists.ts @@ -1,5 +1,5 @@ import {watch, reactive, shallowReactive, unref, toRefs, readonly} from 'vue' -import {defineStore} from 'pinia' +import {acceptHMRUpdate, defineStore} from 'pinia' import {useI18n} from 'vue-i18n' import ListService from '@/services/list' @@ -179,4 +179,9 @@ export function useList(listId: MaybeRef) { list, save, } +} + +// support hot reloading +if (import.meta.hot) { + import.meta.hot.accept(acceptHMRUpdate(useListStore, import.meta.hot)) } \ No newline at end of file