فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

perf(A01): lazily load invoice references on treasury form open, not initial route

davoodmehraban89 committed Oct 17, 2026 at 00:48 UTC f4c6c19a2d6d7d617dc341c86dd2ac97fdcf51d1
1 file changed +8 -3
src/views/TreasuryView.js
+8 -3
@@ -45,7 +45,8 @@ class TreasuryViewImpl {
45 cache.balances = await TreasuryController.getBalanceMap();
46 cache.transactions = await TreasuryController.getTransactions();
47 cache.contacts = await ContactController.getAll();
48 - cache.invoices = await InvoiceController.getAll();
48 + // Invoice list is loaded only when opening a settlement dialog, not on
49 + // every Treasury route render or startup (large companies may have 50k+).
50 }
51
52 _switchTab(tab, btn) {
@@ -427,11 +428,13 @@ class TreasuryViewImpl {
428 if(row?.contactId && contact) contact.value=row.contactId;
429 }
430
430 - openReceiptModal() {
431 + async openReceiptModal() {
432 if (cache.accounts.length === 0) {
433 Toast.warning('ابتدا یک حساب یا صندوق تعریف کنید');
434 return;
435 }
436 + try { cache.invoices = await InvoiceController.getAll(); }
437 + catch (error) { Toast.error('بارگذاری فاکتورها: ' + error.message); return; }
438 const body = `
439 <div class="form-row">
440 <div class="form-group">
@@ -485,11 +488,13 @@ class TreasuryViewImpl {
488 Modal.open({ title: 'ثبت دریافت وجه', body, footer, size: 'md' });
489 }
490
488 - openPaymentModal() {
491 + async openPaymentModal() {
492 if (cache.accounts.length === 0) {
493 Toast.warning('ابتدا یک حساب یا صندوق تعریف کنید');
494 return;
495 }
496 + try { cache.invoices = await InvoiceController.getAll(); }
497 + catch (error) { Toast.error('بارگذاری فاکتورها: ' + error.message); return; }
498 const body = `
499 <div class="form-row">
500 <div class="form-group">