fix: avoid duplicate PDA warehouse profile requests

This commit is contained in:
2026-09-07 19:27:18 +08:00
parent 449b5d2e99
commit de70382c08
2 changed files with 10 additions and 1 deletions
+5 -1
View File
@@ -57,7 +57,11 @@
return '晚上好'
}
},
onShow() { if (!requireSession()) return; this.user = session.currentUser; this.loadWarehouseProfile() },
onShow() {
if (!requireSession()) return
this.user = session.currentUser
if (!this.user?.warehouseCode || !this.user?.warehouseName) this.loadWarehouseProfile()
},
onBackPress() {
if (!this.menuOpen) return false
this.$refs.portalHeader.closeMenu()
+5
View File
@@ -145,3 +145,8 @@ test('Chinese English and Spanish locale selection is persisted from profile wit
assert.match(profile, /uni\.showActionSheet[\s\S]*setLocale\(selected\.value\)/)
assert.match(inbound, /warehouse-profile/)
})
test('home reuses the persisted warehouse profile instead of requesting it on every show', async () => {
const home = await read('../src/pages/home/home.vue')
assert.match(home, /if \(!this\.user\?\.warehouseCode \|\| !this\.user\?\.warehouseName\) this\.loadWarehouseProfile\(\)/)
})