feat(offline): implement Dexie fallbacks and fix type stability in Events module
- Offline Resilience: Added local Dexie fallbacks to load_ae_obj_id__* and load_ae_obj_li__* functions for Events, Sessions, Locations, Exhibits, and Badges. - Type Safety: Standardized ae_Event and ae_EventSession interfaces in ae_types.ts; resolved Promise assignment errors in load functions (+page.ts). - Bug Fixes: Corrected duplication in ae_events__event_location.ts and ae_events__event_badge_template.ts; fixed missing try_cache parameters. - UI Stability: Fixed Dexie LiveQuery subscription pattern in bulk print view and ensured proper property access in layout load functions.
This commit is contained in:
@@ -30,7 +30,7 @@ export async function load({ params, parent }) {
|
||||
|
||||
if (browser) {
|
||||
// Load event location object
|
||||
const load_event_location_obj = events_func.load_ae_obj_id__event_location({
|
||||
const load_event_location_obj = await events_func.load_ae_obj_id__event_location({
|
||||
api_cfg: ae_acct.api,
|
||||
event_location_id: event_location_id,
|
||||
try_cache: true
|
||||
@@ -39,71 +39,45 @@ export async function load({ params, parent }) {
|
||||
ae_acct.slct.event_location_obj = load_event_location_obj;
|
||||
|
||||
// Load event sessions for the location
|
||||
const load_event_session_obj_li = events_func
|
||||
.load_ae_obj_li__event_session({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_location',
|
||||
for_obj_id: event_location_id,
|
||||
enabled: 'all',
|
||||
limit: 50,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then((event_session_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_session_obj_li = `, event_session_obj_li);
|
||||
}
|
||||
for (let index = 0; index < event_session_obj_li.length; index++) {
|
||||
const event_session_obj = event_session_obj_li[index];
|
||||
const event_session_id = event_session_obj.event_session_id_random;
|
||||
const event_session_obj_li = await events_func.load_ae_obj_li__event_session({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_location',
|
||||
for_obj_id: event_location_id,
|
||||
enabled: 'all',
|
||||
limit: 50,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
const load_event_presentation_obj_li =
|
||||
events_func.load_ae_obj_li__event_presentation({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_session',
|
||||
for_obj_id: event_session_id,
|
||||
enabled: 'all',
|
||||
limit: 25,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`load_event_presentation_obj_li = `,
|
||||
load_event_presentation_obj_li
|
||||
);
|
||||
}
|
||||
event_session_obj_li[index].event_presentation_li =
|
||||
load_event_presentation_obj_li;
|
||||
}
|
||||
if (event_session_obj_li) {
|
||||
for (let index = 0; index < event_session_obj_li.length; index++) {
|
||||
const event_session_obj = event_session_obj_li[index];
|
||||
const event_session_id = event_session_obj.event_session_id || event_session_obj.id;
|
||||
|
||||
return event_session_obj_li;
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_session_obj_li = `, load_event_session_obj_li);
|
||||
const load_event_presentation_obj_li = await events_func.load_ae_obj_li__event_presentation({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_session',
|
||||
for_obj_id: event_session_id,
|
||||
enabled: 'all',
|
||||
limit: 25,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
event_session_obj_li[index].event_presentation_li = load_event_presentation_obj_li;
|
||||
}
|
||||
}
|
||||
ae_acct.slct.event_session_obj_li = load_event_session_obj_li;
|
||||
ae_acct.slct.event_session_obj_li = event_session_obj_li;
|
||||
|
||||
const load_event_file_obj_li = await events_func
|
||||
.load_ae_obj_li__event_file({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_location',
|
||||
for_obj_id: event_location_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
limit: 50,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then((event_file_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_file_obj_li = `, event_file_obj_li);
|
||||
}
|
||||
return event_file_obj_li;
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_file_obj_li = `, load_event_file_obj_li);
|
||||
}
|
||||
const load_event_file_obj_li = await events_func.load_ae_obj_li__event_file({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_location',
|
||||
for_obj_id: event_location_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
limit: 50,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
ae_acct.slct.event_file_obj_li = load_event_file_obj_li;
|
||||
|
||||
const load_event_device_obj_li = events_func.load_ae_obj_li__event_device({
|
||||
const load_event_device_obj_li = await events_func.load_ae_obj_li__event_device({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_location',
|
||||
for_obj_id: event_location_id,
|
||||
|
||||
@@ -47,75 +47,50 @@ export async function load({ params, parent }) {
|
||||
ae_acct.slct.event_session_obj = load_event_session_obj;
|
||||
|
||||
// Load event presentations for the session
|
||||
const load_event_presentation_obj_li = events_func
|
||||
.load_ae_obj_li__event_presentation({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_session',
|
||||
for_obj_id: event_session_id,
|
||||
inc_presenter_li: true,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
limit: 19,
|
||||
// params: {},
|
||||
try_cache: true,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then((event_presentation_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_presentation_obj_li = `, event_presentation_obj_li);
|
||||
}
|
||||
for (let index = 0; index < event_presentation_obj_li?.length; index++) {
|
||||
const event_presentation_obj = event_presentation_obj_li[index];
|
||||
const event_presentation_id =
|
||||
event_presentation_obj.event_presentation_id_random;
|
||||
const event_presentation_obj_li = await events_func.load_ae_obj_li__event_presentation({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_session',
|
||||
for_obj_id: event_session_id,
|
||||
inc_presenter_li: true,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
limit: 19,
|
||||
// params: {},
|
||||
try_cache: true,
|
||||
log_lvl: 2
|
||||
});
|
||||
|
||||
const load_event_presenter_obj_li = events_func.load_ae_obj_li__event_presenter(
|
||||
{
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
limit: 19,
|
||||
params: {},
|
||||
try_cache: true,
|
||||
log_lvl: 2
|
||||
}
|
||||
);
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_presenter_obj_li = `, load_event_presenter_obj_li);
|
||||
}
|
||||
event_presentation_obj_li[index].event_presenter_li =
|
||||
load_event_presenter_obj_li;
|
||||
}
|
||||
if (event_presentation_obj_li) {
|
||||
for (let index = 0; index < event_presentation_obj_li.length; index++) {
|
||||
const event_presentation_obj = event_presentation_obj_li[index];
|
||||
const event_presentation_id = event_presentation_obj.event_presentation_id || event_presentation_obj.id;
|
||||
|
||||
return event_presentation_obj_li;
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_presentation_obj_li = `, load_event_presentation_obj_li);
|
||||
const load_event_presenter_obj_li = await events_func.load_ae_obj_li__event_presenter({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
limit: 19,
|
||||
params: {},
|
||||
try_cache: true,
|
||||
log_lvl: 2
|
||||
});
|
||||
event_presentation_obj_li[index].event_presenter_li = load_event_presenter_obj_li;
|
||||
}
|
||||
}
|
||||
ae_acct.slct.event_presentation_obj_li = load_event_presentation_obj_li;
|
||||
ae_acct.slct.event_presentation_obj_li = event_presentation_obj_li;
|
||||
|
||||
// Load event files for the session
|
||||
const load_event_file_obj_li = await events_func
|
||||
.load_ae_obj_li__event_file({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_session',
|
||||
for_obj_id: event_session_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
limit: 50,
|
||||
try_cache: true
|
||||
})
|
||||
.then((event_file_obj_li) => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_file_obj_li = `, event_file_obj_li);
|
||||
}
|
||||
return event_file_obj_li;
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_file_obj_li = `, load_event_file_obj_li);
|
||||
}
|
||||
const load_event_file_obj_li = await events_func.load_ae_obj_li__event_file({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'event_session',
|
||||
for_obj_id: event_session_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
limit: 50,
|
||||
try_cache: true
|
||||
});
|
||||
ae_acct.slct.event_file_obj_li = load_event_file_obj_li;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user