perf(core): standardize non-blocking load pattern and add performance guidelines

- Documented the 'Non-Blocking Load Pattern' (SWR) in 'documentation/PERFORMANCE_GUIDELINES.md' to prevent future performance regressions.
- Refactored 'src/routes/core/people/[person_id]/+page.ts' to be non-blocking, improving perceived speed for person details.
- Updated 'GEMINI.md' standards and 'TODO.md' tasks to reflect system-wide performance hardening.
This commit is contained in:
Scott Idem
2026-01-27 12:32:26 -05:00
parent 9655604d86
commit b837e6d0f8
4 changed files with 103 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
/** @type {import('./$types').PageLoad} */
import { error } from '@sveltejs/kit';
import { browser } from '$app/environment';
console.log(`ae core person [person_id] +page.ts: start`);
import { core_func } from '$lib/ae_core/ae_core_functions';
@@ -18,10 +19,10 @@ export async function load({ params, parent }) {
const ae_acct = { ...data[account_id] };
ae_acct.slct = { ...ae_acct.slct };
console.log(`ae_acct = `, ae_acct);
// console.log(`ae_acct = `, ae_acct);
const person_id = params.person_id;
console.log(`person_id = `, person_id);
// console.log(`person_id = `, person_id);
if (!person_id) {
console.log(
`ae core person [person_id] +page.ts: The person_id was not found in the params!!!`
@@ -33,13 +34,16 @@ export async function load({ params, parent }) {
ae_acct.slct.person_id = person_id;
const load_person_obj = await core_func.load_ae_obj_id__person({
api_cfg: ae_acct.api,
person_id: person_id,
try_cache: true
});
ae_acct.slct.person_obj = load_person_obj;
if (browser) {
// OPTIMIZATION: Fire the refresh in the background.
// The Person View UI uses LiveQuery/Dexie and will update
// automatically once this background task finishes.
core_func.load_ae_obj_id__person({
api_cfg: ae_acct.api,
person_id: person_id,
try_cache: true
});
}
return {
...data,