Fix LNbits 1.4 compatibility: add null guards for g.user.wallets #5

Merged
padreug merged 1 commit from fix/lnbits-1.4-compatibility into main 2026-01-05 10:27:46 +00:00
Owner

Summary

  • Fixes compatibility issue with LNbits 1.4 where g.user can be null during initial Vue template evaluation
  • LNbits 1.4 (PR #3615) moved g.user initialization from windowMixin to base.html, causing timing issues
  • Adds optional chaining (g.user?.wallets || []) in template and null guards in JavaScript

Problem

After upgrading to LNbits 1.4, the extension would show "Status: Not configured" even when config existed, due to:

  1. API call to get config succeeds
  2. Code tries to access this.g.user.wallets before g.user is initialized
  3. Error is caught, lamassuConfig set to null
  4. UI erroneously shows "Not configured"

Changes

  • templates/satmachineadmin/index.html: Use g.user?.wallets || [] for wallet select options
  • static/js/index.js: Add this.g.user?.wallets guard before accessing wallets

Test plan

  • Open satmachineadmin extension on LNbits 1.4
  • Verify config status shows correctly (not "Not configured" if config exists)
  • Verify wallet dropdowns in config dialog work correctly
  • No console errors related to Cannot read properties of null (reading 'wallets')

🤖 Generated with Claude Code

## Summary - Fixes compatibility issue with LNbits 1.4 where `g.user` can be `null` during initial Vue template evaluation - LNbits 1.4 (PR #3615) moved `g.user` initialization from `windowMixin` to `base.html`, causing timing issues - Adds optional chaining (`g.user?.wallets || []`) in template and null guards in JavaScript ## Problem After upgrading to LNbits 1.4, the extension would show "Status: Not configured" even when config existed, due to: 1. API call to get config succeeds 2. Code tries to access `this.g.user.wallets` before `g.user` is initialized 3. Error is caught, `lamassuConfig` set to `null` 4. UI erroneously shows "Not configured" ## Changes - `templates/satmachineadmin/index.html`: Use `g.user?.wallets || []` for wallet select options - `static/js/index.js`: Add `this.g.user?.wallets` guard before accessing wallets ## Test plan - [ ] Open satmachineadmin extension on LNbits 1.4 - [ ] Verify config status shows correctly (not "Not configured" if config exists) - [ ] Verify wallet dropdowns in config dialog work correctly - [ ] No console errors related to `Cannot read properties of null (reading 'wallets')` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
padreug added 1 commit 2026-01-05 10:19:58 +00:00
Fix LNbits 1.4 compatibility: add null guards for g.user.wallets
Some checks failed
CI / lint (push) Waiting to run
CI / tests (3.10) (push) Blocked by required conditions
CI / tests (3.9) (push) Blocked by required conditions
CI / lint (pull_request) Has been cancelled
/ release (push) Has been cancelled
CI / tests (3.10) (pull_request) Has been cancelled
CI / tests (3.9) (pull_request) Has been cancelled
/ pullrequest (push) Has been cancelled
25be6cff87
LNbits 1.4 changed g.user initialization (PR #3615), moving it from
windowMixin to base.html. This means g.user can be null during initial
Vue template evaluation.

- Use optional chaining g.user?.wallets || [] in template
- Add null guard before accessing this.g.user.wallets in JS

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
padreug merged commit 25be6cff87 into main 2026-01-05 10:27:46 +00:00
padreug deleted branch fix/lnbits-1.4-compatibility 2026-01-05 10:27:46 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: aiolabs/satmachineadmin#5
No description provided.