fixes wallet ws (#2912)

This commit is contained in:
Arc 2025-01-28 12:14:12 +00:00 committed by GitHub
parent 25e5423511
commit 66b2ca2ac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 14 deletions

File diff suppressed because one or more lines are too long

View file

@ -451,7 +451,9 @@ if (!window.g) {
payments: [], payments: [],
allowedThemes: null, allowedThemes: null,
langs: [], langs: [],
walletEventListeners: [] walletEventListeners: [],
updatePayments: false,
updatePaymentsHash: ''
}) })
} }
@ -461,8 +463,6 @@ window.windowMixin = {
return { return {
g: window.g, g: window.g,
toggleSubs: true, toggleSubs: true,
updatePayments: false,
updatePaymentsHash: '',
mobileSimple: true, mobileSimple: true,
walletFlip: true, walletFlip: true,
borderSelection: null, borderSelection: null,
@ -528,7 +528,7 @@ window.windowMixin = {
//update the current wallet //update the current wallet
if (this.g.wallet.id === data.payment.wallet_id) { if (this.g.wallet.id === data.payment.wallet_id) {
Object.assign(this.g.wallet, this.g.user.wallets[walletIndex]) Object.assign(this.g.wallet, this.g.user.wallets[walletIndex])
this.updatePayments = !this.updatePayments
//if on the wallet page and payment is incoming trigger the eventReaction //if on the wallet page and payment is incoming trigger the eventReaction
if ( if (
data.payment.amount > 0 && data.payment.amount > 0 &&
@ -538,14 +538,16 @@ window.windowMixin = {
} }
} }
} }
this.updatePaymentsHash = data.payment.payment_hash this.g.updatePaymentsHash = data.payment.payment_hash
this.g.updatePayments = !this.g.updatePayments
}) })
} }
}) })
}, },
selectWallet(wallet) { selectWallet(wallet) {
Object.assign(this.g.wallet, wallet) Object.assign(this.g.wallet, wallet)
this.updatePayments = !this.updatePayments // this.wallet = this.g.wallet
this.g.updatePayments = !this.g.updatePayments
this.balance = parseInt(wallet.balance_msat / 1000) this.balance = parseInt(wallet.balance_msat / 1000)
const currentPath = this.$route.path const currentPath = this.$route.path
if (currentPath !== '/wallet') { if (currentPath !== '/wallet') {
@ -663,9 +665,9 @@ window.windowMixin = {
} }
let style = document.createElement('style') let style = document.createElement('style')
style.innerHTML = ` style.innerHTML = `
body[data-theme="${this.themeChoice}"] .q-card, body[data-theme="${this.themeChoice}"] .q-card,
body[data-theme="${this.themeChoice}"] .q-card.q-card--dark, body[data-theme="${this.themeChoice}"] .q-card.q-card--dark,
body[data-theme="${this.themeChoice}"] .q-date, body[data-theme="${this.themeChoice}"] .q-date,
body[data-theme="${this.themeChoice}"] .q-date--dark { body[data-theme="${this.themeChoice}"] .q-date--dark {
${borderStyleCSS} ${borderStyleCSS}
} }

View file

@ -201,7 +201,7 @@ window.WalletPageLogic = {
'hiddenQrCodeContainer' 'hiddenQrCodeContainer'
).innerHTML ).innerHTML
}) })
this.updatePayments = !this.updatePayments this.g.updatePayments = !this.g.updatePayments
}) })
.catch(err => { .catch(err => {
LNbits.utils.notifyApiError(err) LNbits.utils.notifyApiError(err)
@ -381,7 +381,7 @@ window.WalletPageLogic = {
.catch(err => { .catch(err => {
dismissPaymentMsg() dismissPaymentMsg()
LNbits.utils.notifyApiError(err) LNbits.utils.notifyApiError(err)
this.updatePayments = !this.updatePayments this.g.updatePayments = !this.g.updatePayments
this.parse.show = false this.parse.show = false
}) })
}, },
@ -713,9 +713,10 @@ window.WalletPageLogic = {
this.createdTasks() this.createdTasks()
}, },
watch: { watch: {
updatePayments() { 'g.updatePayments'(newVal, oldVal) {
console.log('updatePayments changed:', {newVal, oldVal})
this.parse.show = false this.parse.show = false
if (this.receive.paymentHash === this.updatePaymentsHash) { if (this.receive.paymentHash === this.g.updatePaymentsHash) {
this.receive.show = false this.receive.show = false
this.receive.paymentHash = null this.receive.paymentHash = null
} }