fix: mapping of user was done each time component was initialised (#3573)

This commit is contained in:
dni ⚡
2025-11-26 13:21:36 +01:00
committed by GitHub
parent baa9a35773
commit 21505471d5
6 changed files with 19 additions and 40 deletions
+6 -10
View File
@@ -15,16 +15,12 @@ window.LNbits = {
extra: data.extra ?? {}
}
const mapWallet = this.wallet
obj.wallets = obj.wallets
.map(obj => {
return mapWallet(obj)
})
.sort((a, b) => {
if (a.extra.pinned !== b.extra.pinned) {
return a.extra.pinned ? -1 : 1
}
return a.name.localeCompare(b.name)
})
obj.wallets = obj.wallets.map(mapWallet).sort((a, b) => {
if (a.extra.pinned !== b.extra.pinned) {
return a.extra.pinned ? -1 : 1
}
return a.name.localeCompare(b.name)
})
obj.walletOptions = obj.wallets.map(obj => {
return {
label: [obj.name, ' - ', obj.id.substring(0, 5), '...'].join(''),
+6
View File
@@ -86,6 +86,12 @@ window.i18n = new VueI18n.createI18n({
})
window.app.mixin({
data() {
return {
g: window.g,
...WINDOW_SETTINGS
}
},
computed: {
isVueRoute() {
const currentPath = window.location.pathname
+4 -17
View File
@@ -1,12 +1,4 @@
window.windowMixin = {
i18n: window.i18n,
data() {
return {
g: window.g,
utils: window._lnbitsUtils,
...WINDOW_SETTINGS
}
},
methods: {
openNewWalletDialog(walletType = 'lightning') {
this.g.newWalletType = walletType
@@ -115,16 +107,11 @@ window.windowMixin = {
})
}
},
async created() {
if (window.user) {
this.g.user = Vue.reactive(window.LNbits.map.user(window.user))
created() {
// map jinja variable once on pageload
if (window.user && !this.g.user) {
this.g.user = window.LNbits.map.user(window.user)
this.paymentEvents()
}
if (window.wallet) {
this.g.wallet = Vue.reactive(window.LNbits.map.wallet(window.wallet))
}
if (window.extensions) {
this.g.extensions = Vue.reactive(window.extensions)
}
}
}