Skip to content

Commit

Permalink
edit-menu: Fix dropdown reset after resetting saved profiles
Browse files Browse the repository at this point in the history
When a user reset the profiles, the dropdown remained selected at the name of the profile that was active before resetting.
  • Loading branch information
rafaellehmkuhl authored and patrickelectric committed Feb 15, 2023
1 parent 0524dd1 commit a9d8e47
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/components/EditMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</v-expansion-panels>
<div class="flex items-center w-10/12 my-2 justify-evenly">
<v-select
v-model="selectedProfile"
v-model="store.currentProfile"
:items="Object.values(store.savedProfiles)"
item-title="name"
class="w-10/12 m-1 max-h-16"
Expand Down Expand Up @@ -159,7 +159,6 @@ const emit = defineEmits<{
const openPanels = ref([0])
const availableWidgetTypes = computed(() => Object.values(WidgetType))
const selectedWidgetType = ref()
const selectedProfile = ref(store.currentProfile)
const selectedLayer = ref(store.currentProfile.layers[0])
const newProfileName = ref('')
const newProfileForm = ref(false)
Expand Down Expand Up @@ -205,19 +204,13 @@ const availableLayers = computed(() =>
)
const loadProfile = (): void => {
if (selectedProfile.value === undefined) {
console.warn('Cannot load profile. No profile selected.')
return
}
store.loadProfile(selectedProfile.value)
selectedLayer.value = store.currentProfile.layers[0]
}
const createNewProfile = async (): Promise<void> => {
profileCreationDialogRevealed.value = false
try {
const newProfile = store.saveProfile(newProfileName.value, JSON.parse(JSON.stringify(store.currentProfile.layers)))
store.loadProfile(newProfile)
selectedProfile.value = store.currentProfile
newProfileName.value = ''
profileCreationDialog.confirm()
} catch (error) {
Expand Down

0 comments on commit a9d8e47

Please sign in to comment.