logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/
commit: f75ea738cad7353202dd9c74b06cedb11c6f7be0
parent 97c058ebdaeefbffb11461d8ed9a3a1627548d11
Author: Henry Jameson <me@hjkos.com>
Date:   Mon,  7 Oct 2024 01:31:22 +0300

better cValue logic in shadow-control

Diffstat:

Msrc/components/select/select_motion.vue4+---
Msrc/components/shadow_control/shadow_control.js19+++++++++----------
2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/components/select/select_motion.vue b/src/components/select/select_motion.vue @@ -82,9 +82,7 @@ const moveDn = () => { } const add = () => { - const newModel = [...props.modelValue] - newModel.push(props.getAddValue()) - console.log(newModel) + const newModel = [...props.modelValue, props.getAddValue()] emit('update:modelValue', newModel) emit('update:selectedId', Math.max(newModel.length - 1, 0)) diff --git a/src/components/shadow_control/shadow_control.js b/src/components/shadow_control/shadow_control.js @@ -50,11 +50,8 @@ export default { ], emits: ['update:modelValue', 'subShadowSelected'], data () { - console.log('MODEL VALUE', this.modelValue, this.fallback) return { - selectedId: 0, - // TODO there are some bugs regarding display of array (it's not getting updated when deleting for some reason) - cValue: (this.modelValue ?? this.fallback ?? []).map(toModel) + selectedId: 0 } }, components: { @@ -66,10 +63,15 @@ export default { Popover, ComponentPreview }, - beforeUpdate () { - this.cValue = (this.modelValue ?? this.fallback ?? []).map(toModel) - }, computed: { + cValue: { + get () { + return (this.modelValue ?? this.fallback ?? []).map(toModel) + }, + set (newVal) { + this.$emit('update:modelValue', newVal) + } + }, selectedType: { get () { return typeof this.selected @@ -124,9 +126,6 @@ export default { } }, watch: { - modelValue (value) { - if (!value) this.cValue = (this.modelValue ?? this.fallback ?? []).map(toModel) - }, selected (value) { this.$emit('subShadowSelected', this.selectedId) }