Skip to content

Commit

Permalink
therml preset data handling fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeKeck committed Aug 25, 2024
1 parent 7d268f3 commit 8649fe9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions src/components/settings/presets/PresetSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
}"
>
<section
v-for="(preset, i) in presets"
:key="`preset-${i}`"
v-for="preset in presets"
:key="`preset-${preset.id}`"
>
<v-divider />

Expand Down Expand Up @@ -117,17 +117,12 @@ export default class TemperaturePresetSettings extends Mixins(StateMixin) {
return this.$store.getters['printer/getOutputs'](['temperature_fan'])
}
_presets?: TemperaturePreset[] = undefined
get presets () {
if (this._presets === undefined) {
this._presets = this.$store.getters['config/getTempPresets']
}
return this._presets ?? []
return this.$store.getters['config/getTempPresets']
}
set presets (presets: TemperaturePreset[]) {
this.$store.dispatch('config/saveAllPresetOrder', presets)
this._presets = presets
this.$store.dispatch('config/saveAllPresestOrder', presets)
}
dialogState: any = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/thermals/TemperaturePresetsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import StateMixin from '@/mixins/state'
import type { TemperaturePreset } from '@/store/config/types';
import type { TemperaturePreset } from '@/store/config/types'
@Component({})
export default class TemperaturePresetsMenu extends Mixins(StateMixin) {
Expand Down
2 changes: 1 addition & 1 deletion src/store/config/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const actions: ActionTree<ConfigState, RootState> = {
SocketActions.serverWrite('uiSettings.dashboard.tempPresets', state.uiSettings.dashboard.tempPresets)
},

saveAllPresetOrder ({ commit, state }, payload: TemperaturePreset[]) {
saveAllPresestOrder ({ commit, state }, payload: TemperaturePreset[]) {
// Commit the change...
payload.forEach((preset, index) => {
commit('setPreset', {
Expand Down

0 comments on commit 8649fe9

Please sign in to comment.