fix(sync): restrict room refreshes to selected session to prevent flickering

- Optimized background API refreshes to focus on the selected session instead of the entire room.\n- Eliminated redundant bulk database writes that were causing UI flickering during refresh cycles.\n- Staggered initial data fetches to prevent API request storms.\n- Added detailed logging for easier tracing of background sync operations.
This commit is contained in:
Scott Idem
2026-02-10 18:38:39 -05:00
parent ab2b984c25
commit d300825312

View File

@@ -134,6 +134,7 @@
const location_id = $events_slct.event_location_id;
if (!location_id) return;
try {
if (log_lvl > 1) console.log(`Sync: Refreshing sessions for location: ${location_id}`);
await events_func.load_ae_obj_li__event_session({
api_cfg: $ae_api,
for_obj_type: 'event_location',
@@ -146,16 +147,17 @@
}
/**
* API Refresh: Presentations in Room
* API Refresh: Presentations for Selected Session
*/
async function refresh_presentation_data() {
const location_id = $events_slct.event_location_id;
if (!location_id) return;
const session_id = $events_slct.event_session_id;
if (!session_id) return;
try {
if (log_lvl > 1) console.log(`Sync: Refreshing presentations for session: ${session_id}`);
await events_func.load_ae_obj_li__event_presentation({
api_cfg: $ae_api,
for_obj_type: 'event_location',
for_obj_id: location_id,
for_obj_type: 'event_session',
for_obj_id: session_id,
try_cache: true,
log_lvl: 0
});
@@ -163,16 +165,17 @@
}
/**
* API Refresh: Presenters in Room
* API Refresh: Presenters for Selected Session
*/
async function refresh_presenter_data() {
const location_id = $events_slct.event_location_id;
if (!location_id) return;
const session_id = $events_slct.event_session_id;
if (!session_id) return;
try {
if (log_lvl > 1) console.log(`Sync: Refreshing presenters for session: ${session_id}`);
await events_func.load_ae_obj_li__event_presenter({
api_cfg: $ae_api,
for_obj_type: 'event_location',
for_obj_id: location_id,
for_obj_type: 'event_session',
for_obj_id: session_id,
try_cache: true,
log_lvl: 0
});