fix(upload): replace db_events.file.clear() with targeted per-object reload
db_events.file.clear() after every upload was nuking the entire Dexie file table. Every liveQuery watching any file list (Launcher, other locations, sessions, presenters) would immediately show 0 results. Only the uploaded-to object's files were reloaded; all others remained empty until their own background syncs fired — intermittent disappearance that depended on timing. Fix: targeted load_ae_obj_li__event_file for only the current link_to_id, which uses the SWR pattern (returns cache + background refresh that includes the newly created file). Other objects' file caches are untouched. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,6 @@ import {
|
||||
events_trig
|
||||
} from '$lib/stores/ae_events_stores';
|
||||
import { events_func } from '$lib/ae_events/ae_events_functions';
|
||||
import { db_events } from '$lib/ae_events/db_events';
|
||||
|
||||
interface Props {
|
||||
log_lvl?: number;
|
||||
@@ -110,9 +109,13 @@ async function handle_submit_form_files(event: SubmitEvent) {
|
||||
$events_sess.files.processed_file_list = [];
|
||||
target.reset();
|
||||
|
||||
// Refresh Local Cache (Optimistic Revalidation)
|
||||
await db_events.file.clear();
|
||||
events_func.load_ae_obj_li__event_file({
|
||||
// Refresh the file list for this object only.
|
||||
// WHY: Previously used db_events.file.clear() here, which nuked the ENTIRE
|
||||
// file table in Dexie. Every liveQuery watching any file list would immediately
|
||||
// show 0 results, and only this object's files were reloaded. Files for all
|
||||
// other objects (locations, sessions, presenters) remained missing until their
|
||||
// own background syncs fired. Targeted reload avoids that side effect.
|
||||
await events_func.load_ae_obj_li__event_file({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_type: link_to_type,
|
||||
for_obj_id: link_to_id,
|
||||
|
||||
Reference in New Issue
Block a user