Merge pull request #2 from kbenestad/claude/fix-form-layout-P8uHa

Fix crash: state initialized before CFG is loaded
This commit is contained in:
Kristian Benestad 2026-05-13 16:33:40 +07:00 committed by GitHub
commit cae6416ffd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -140,7 +140,7 @@ async function loadConfig() {
}
// ========== STATE ==========
const state = { staff: '', periodFrom: '', periodTo: '', baseCurrency: CFG['currency-base'], fxRateMemory: {}, items: [], _grandTotal: 0 };
const state = { staff: '', periodFrom: '', periodTo: '', baseCurrency: '', fxRateMemory: {}, items: [], _grandTotal: 0 };
function newItem() { return { id: uid(), name: '', lines: [newLine()], _subtotal: 0 }; }
function newLine() {
@ -848,6 +848,7 @@ async function onGenerate() {
async function init() {
try {
await loadConfig();
state.baseCurrency = CFG['currency-base'];
state.items.push(newItem());
render();
} catch (e) {