From 220ece6027df2bdb98414761d4c25caf0b390fd4 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Fri, 20 Feb 2026 10:22:10 +0000 Subject: [PATCH] fix mixed bindings --- lnbits/static/js/components/lnbits-dialog.js | 38 +++++++------------ lnbits/templates/components/lnbits-dialog.vue | 17 +++------ 2 files changed, 19 insertions(+), 36 deletions(-) diff --git a/lnbits/static/js/components/lnbits-dialog.js b/lnbits/static/js/components/lnbits-dialog.js index 87fbcccf3..39a911c5d 100644 --- a/lnbits/static/js/components/lnbits-dialog.js +++ b/lnbits/static/js/components/lnbits-dialog.js @@ -4,11 +4,7 @@ window.app.component('lnbits-dialog', { props: { show: { type: Boolean, - default: undefined - }, - modelValue: { - type: Boolean, - default: undefined + default: false }, title: { type: String, @@ -40,7 +36,7 @@ window.app.component('lnbits-dialog', { } }, - emits: ['update:show', 'update:model-value', 'hide', 'cancel', 'action'], + emits: ['update:show', 'hide', 'cancel', 'action'], computed: { hasAction() { @@ -52,27 +48,15 @@ window.app.component('lnbits-dialog', { return { label: action.label || 'Action', color: action.color || 'primary', - outline: !!action.outline, - flat: !!action.flat, - unelevated: !!action.unelevated, - noCaps: !!action.noCaps, - icon: action.icon || undefined, loading: !!action.loading, disable: !!action.disable } - }, - - dialogShow() { - if (typeof this.show === 'boolean') return this.show - if (typeof this.modelValue === 'boolean') return this.modelValue - return false } }, methods: { handleModelUpdate(value) { this.$emit('update:show', value) - this.$emit('update:model-value', value) }, handleHide() { @@ -84,15 +68,19 @@ window.app.component('lnbits-dialog', { this.$emit('cancel') }, - handleAction() { - if (this.action && typeof this.action.handler === 'function') { - this.action.handler() - } + async handleAction() { + try { + if (this.action && typeof this.action.handler === 'function') { + await this.action.handler() + } - this.$emit('action') + this.$emit('action') - if (this.action && this.action.closeOnClick) { - this.handleModelUpdate(false) + if (this.action && this.action.closeOnClick) { + this.handleModelUpdate(false) + } + } catch (error) { + console.error('lnbits-dialog action handler failed', error) } } } diff --git a/lnbits/templates/components/lnbits-dialog.vue b/lnbits/templates/components/lnbits-dialog.vue index 687fbb630..9e48ed32b 100644 --- a/lnbits/templates/components/lnbits-dialog.vue +++ b/lnbits/templates/components/lnbits-dialog.vue @@ -3,7 +3,7 @@ :model-value="show" :position="position" :persistent="persistent" - @update:model-value="$emit('update:show', $event)" + @update:model-value="handleModelUpdate" @hide="handleHide" > @@ -17,31 +17,26 @@ - - - + -