diff --git a/web/modules/custom/figli_compta_ledger/js/home.js b/web/modules/custom/figli_compta_ledger/js/home.js index 2ccb303..913f195 100644 --- a/web/modules/custom/figli_compta_ledger/js/home.js +++ b/web/modules/custom/figli_compta_ledger/js/home.js @@ -336,8 +336,16 @@ } }); }, - async load() { - this.loading = true; + // showLoading defaults to true for the initial mount, where there's + // nothing on screen yet to preserve. A post-edit refresh passes + // false: flipping `loading` back to true would unmount the whole + // v-else table (the "Chargement…" paragraph takes its place) and + // remount it from scratch once the fetch resolves -- exactly the + // full-table flicker/scroll-reset Vue's keyed diffing exists to + // avoid. Reassigning `rows` in place lets Vue patch just the rows + // that actually changed. + async load(showLoading = true) { + if (showLoading) this.loading = true; this.error = null; try { const { data, includedMap } = await fetchAllLignes(); @@ -345,13 +353,13 @@ } catch (err) { this.error = err.message; } finally { - this.loading = false; + if (showLoading) this.loading = false; } }, }, mounted() { this.load(); - jQuery(document).on('dialog:afterclose', () => this.load()); + jQuery(document).on('dialog:afterclose', () => this.load(false)); }, };