perf(invoices): the invoice editor renders on the first paint from the session cache (#1937)
"Ny faktura" was the slowest form to fill in: the list page lazy-loaded NewInvoiceDialog, which lazy-loaded InvoiceEditor (ssr:false), which then issued four requests on mount (customers, articles, chart of accounts, company settings) and hid the ENTIRE form behind a spinner until the customers query alone resolved, even though the other three had landed. Reopening the dialog paid all of it again. - InvoiceEditor reads customers, articles, posting accounts and settings from lib/reference-data (seeded by the dashboard layout). The whole-form spinner gate is gone; the customer picker shows "Hämtar kunder ..." only while the list is genuinely uncached. Company settings are applied once per editor instance through a guarded effect, so a background revalidation can never re-run the create-mode prefills over notes or a reference the user has typed. Inline customer/article creation invalidates the shared cache (awaited, so the new option resolves before the line points at it). Customers now come through /api/customers, which masks the personnummer column; nothing in the editor rendered it. - NewInvoiceDialog imports the editor statically: the dialog is itself a next/dynamic chunk on the list page, so this is one deferred chunk download when the dialog opens instead of two sequential ones. - New strings: invoice_editor.loading_customers (sv + en). Per "Ny faktura": 2 sequential chunk loads -> 1; blocking mount requests 4 -> 0 (cached) with every field populated on the first render. raw-reference-fetch ratchet: 46 -> 45 files. SendInvoiceDialog and PaymentBookingDialog (init() flows) stay in the baseline for a later PR. Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Jakob Wennberg
Claude Fable 5
parent
567fae654c
commit
40e773548c
@@ -3758,6 +3758,7 @@
|
||||
"bank_add_now": "Add now",
|
||||
"customer_card_title": "Customer",
|
||||
"select_customer_placeholder": "Select customer",
|
||||
"loading_customers": "Loading customers ...",
|
||||
"no_customers_yet": "No customers yet",
|
||||
"create_customer": "Create customer",
|
||||
"create_customer_dialog_title": "Add customer",
|
||||
|
||||
@@ -3758,6 +3758,7 @@
|
||||
"bank_add_now": "Lägg till nu",
|
||||
"customer_card_title": "Kund",
|
||||
"select_customer_placeholder": "Välj kund",
|
||||
"loading_customers": "Hämtar kunder ...",
|
||||
"no_customers_yet": "Inga kunder än",
|
||||
"create_customer": "Skapa kund",
|
||||
"create_customer_dialog_title": "Lägg till kund",
|
||||
|
||||
Reference in New Issue
Block a user