Skip to content

Commit 6eafdf4

Browse files
committed
Get initial value from appStore
Avoids issue where component would be mounted to constant default value even though store value was not the default
1 parent c360254 commit 6eafdf4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/misc widgets/CtlSlider.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ const qcStore = useQCStore()
2525
2626
const genePage = PAGE_NAMES.GENE
2727
28-
const inputValue = ref(controlSet.defaultValue)
28+
const getStoreValue = () => {
29+
if (controlSet.topKey === 'filter') {
30+
return appStore[appStore.currentPageName]?.filters?.[controlSet.storeKey]
31+
}
32+
return appStore[appStore.currentPageName]?.[controlSet.storeKey]
33+
}
34+
35+
const storeValue = getStoreValue()
36+
const inputValue = ref(storeValue ?? controlSet.defaultValue)
2937
const controlLabel = ref(`${controlSet.title} ${inputValue.value}`)
3038
3139
const enabled = computed(() => {

0 commit comments

Comments
 (0)