From 74758a25d546e235e41c647beb20d3d7979d5ad7 Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Wed, 31 Jan 2024 17:31:02 +0100 Subject: [PATCH] fix!: more comprehensive usage of types (#65) Release-As: 0.4.5 --- src/store/seqvarInfo/store.ts | 16 ++++++++-------- src/store/strucvarInfo/store.spec.ts | 4 ++-- src/store/strucvarInfo/store.ts | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/store/seqvarInfo/store.ts b/src/store/seqvarInfo/store.ts index 083ec6c..f23ca90 100644 --- a/src/store/seqvarInfo/store.ts +++ b/src/store/seqvarInfo/store.ts @@ -38,7 +38,7 @@ export const useSeqvarInfoStore = defineStore('seqvarInfo', () => { const txCsq = ref(undefined) /** Promise for initialization of the store. */ - const loadDataRes = ref | undefined>(undefined) + const initializeRes = ref | undefined>(undefined) /** Clear all data in the store. */ const clearData = () => { @@ -51,16 +51,16 @@ export const useSeqvarInfoStore = defineStore('seqvarInfo', () => { } /** - * Load data from the server. + * Initialize and oad data from the server. * * @param seqvar$ The sequence variant to use for the query. * @param forceReload Whether to force-reload in case the variant is the same. * @returns */ - const loadData = async (seqvar$: Seqvar, forceReload: boolean = false) => { + const initialize = async (seqvar$: Seqvar, forceReload: boolean = false) => { // Protect against loading multiple times. if (!forceReload && storeState.value !== StoreState.Initial && equal(seqvar$, seqvar.value)) { - return loadDataRes.value + return initializeRes.value } // Clear against artifact @@ -74,7 +74,7 @@ export const useSeqvarInfoStore = defineStore('seqvarInfo', () => { let hgncId = '' // Retrieve variant information from annonars and mehari. - loadDataRes.value = Promise.all([ + initializeRes.value = Promise.all([ annonarsClient.fetchVariantInfo(seqvar$).then((data) => { varAnnos.value = data.result }), @@ -117,11 +117,11 @@ export const useSeqvarInfoStore = defineStore('seqvarInfo', () => { storeState.value = StoreState.Error }) - return loadDataRes.value + return initializeRes.value } return { - loadDataRes, + initializeRes, storeState, seqvar, varAnnos, @@ -129,7 +129,7 @@ export const useSeqvarInfoStore = defineStore('seqvarInfo', () => { geneInfo, hpoTerms, txCsq, - loadData, + initialize, clearData } }) diff --git a/src/store/strucvarInfo/store.spec.ts b/src/store/strucvarInfo/store.spec.ts index 0d26dac..4747dbc 100644 --- a/src/store/strucvarInfo/store.spec.ts +++ b/src/store/strucvarInfo/store.spec.ts @@ -103,7 +103,7 @@ describe('svInfo store', () => { const store = useStrucvarInfoStore() // act: - await store.loadData(structuredClone(strucvarInfo)) + await store.initialize(structuredClone(strucvarInfo)) // assert: expect(store.storeState).toBe(StoreState.Active) @@ -126,7 +126,7 @@ describe('svInfo store', () => { const store = useStrucvarInfoStore() // act: - await store.loadData(structuredClone(strucvarInfo)) + await store.initialize(structuredClone(strucvarInfo)) // assert: expect(store.storeState).toBe(StoreState.Error) diff --git a/src/store/strucvarInfo/store.ts b/src/store/strucvarInfo/store.ts index 01a4b90..f33e508 100644 --- a/src/store/strucvarInfo/store.ts +++ b/src/store/strucvarInfo/store.ts @@ -43,12 +43,12 @@ export const useStrucvarInfoStore = defineStore('strucvarInfo', () => { } /** - * Load data from the server. + * Initialize and load data from the server. * * @param strucvar$ The structural variant to use for the query. * @param forceReload Whether to force-reload in case the variant is the same. */ - const loadData = async (strucvar$: Strucvar, forceReload: boolean = false) => { + const initialize = async (strucvar$: Strucvar, forceReload: boolean = false) => { // Protect against loading multiple times. if ( !forceReload && @@ -104,6 +104,6 @@ export const useStrucvarInfoStore = defineStore('strucvarInfo', () => { genesInfos, clinvarSvRecords, clearData, - loadData + initialize } })