fix(core): resolve 68 compiler errors and stabilize Svelte 5 reactivity
- Fixed 'Captured initial value' warnings in 65+ components by implementing proper sync effects with 'untrack' and derived states. - Hardened Event Settings JSON editors using a temporary string-buffer pattern to safely decouple object-based data from CodeMirror's string requirements. - Resolved strict TypeScript mismatches across core routes (Accounts, Sites, etc.) and improved property indexing safety in views. - Patched Flowbite-Svelte Drawer transitions for Svelte 5 compatibility using prop spreading. - Added comprehensive safety comments to high-risk reactivity blocks. - Synchronized 'ae_types.ts' with V3 backend models.
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
import Element_websocket_v2 from '$lib/elements/element_websocket_v2.svelte';
|
||||
|
||||
// *** Set initial variables
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = $derived(data[$slct.account_id]);
|
||||
|
||||
import { online } from 'svelte/reactivity/window';
|
||||
|
||||
@@ -75,30 +75,38 @@
|
||||
};
|
||||
}
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`event_id: ${data.params.event_id}`);
|
||||
console.log(`event_location_id: ${data.params.event_location_id}`);
|
||||
console.log(
|
||||
`event_session_id: ${data.url.searchParams.get('session_id')}`
|
||||
);
|
||||
}
|
||||
$events_slct.event_id = data.params.event_id;
|
||||
$events_slct.event_location_id = data.params.event_location_id;
|
||||
$events_slct.event_session_id = data.url.searchParams.get('session_id');
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(`event_id: ${data.params.event_id}`);
|
||||
console.log(`event_location_id: ${data.params.event_location_id}`);
|
||||
console.log(
|
||||
`event_session_id: ${data.url.searchParams.get('session_id')}`
|
||||
);
|
||||
}
|
||||
$events_slct.event_id = data.params.event_id;
|
||||
$events_slct.event_location_id = data.params.event_location_id;
|
||||
$events_slct.event_session_id = data.url.searchParams.get('session_id');
|
||||
});
|
||||
|
||||
// String-Only ID Vision: Sync the device ID from the native environment
|
||||
const native_dev = $ae_loc.native_device;
|
||||
if (native_dev) {
|
||||
$events_slct.event_device_id =
|
||||
native_dev.event_device_id ||
|
||||
native_dev.id ||
|
||||
native_dev.event_device_id_random ||
|
||||
native_dev.id_random;
|
||||
}
|
||||
const native_dev = $derived($ae_loc.native_device);
|
||||
$effect(() => {
|
||||
if (native_dev) {
|
||||
$events_slct.event_device_id =
|
||||
native_dev.event_device_id ||
|
||||
native_dev.id ||
|
||||
native_dev.event_device_id_random ||
|
||||
native_dev.id_random;
|
||||
}
|
||||
});
|
||||
|
||||
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li ?? [
|
||||
''
|
||||
];
|
||||
$effect(() => {
|
||||
if (ae_acct) {
|
||||
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li ?? [
|
||||
''
|
||||
];
|
||||
}
|
||||
});
|
||||
$events_slct.id_li__event_location = ae_acct.slct.id_li__event_location ?? [
|
||||
''
|
||||
];
|
||||
@@ -707,11 +715,13 @@
|
||||
<Drawer
|
||||
class="bg-orange-100 opacity-90 hover:opacity-97 transition-all duration-1000 border border-gray-300 dark:border-gray-600 w-full md:w-96 lg:w-[32rem]"
|
||||
placement="left"
|
||||
transitionType="fly"
|
||||
transitionParams={{
|
||||
x: -520,
|
||||
duration: 200,
|
||||
easing: sineIn
|
||||
{...{
|
||||
transitionType: 'fly',
|
||||
transitionParams: {
|
||||
x: -520,
|
||||
duration: 200,
|
||||
easing: sineIn
|
||||
}
|
||||
}}
|
||||
bind:hidden={$events_loc.launcher.hide_drawer__cfg}
|
||||
id="sidebar1"
|
||||
@@ -755,11 +765,13 @@
|
||||
activateClickOutside={false}
|
||||
class="bg-red-100 opacity-75 hover:opacity-95 transition-all duration-1000"
|
||||
placement="bottom"
|
||||
transitionType="fly"
|
||||
transitionParams={{
|
||||
y: 320,
|
||||
duration: 200,
|
||||
easing: sineIn
|
||||
{...{
|
||||
transitionType: 'fly',
|
||||
transitionParams: {
|
||||
y: 320,
|
||||
duration: 200,
|
||||
easing: sineIn
|
||||
}
|
||||
}}
|
||||
bind:hidden={$events_loc.launcher.hide_drawer__debug}
|
||||
id="sidebar2"
|
||||
|
||||
@@ -37,33 +37,39 @@
|
||||
|
||||
// Variables
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = $derived(data[$slct.account_id]);
|
||||
|
||||
// $ae_loc.url_origin = data.url.origin;
|
||||
|
||||
log_lvl = 1;
|
||||
if (log_lvl) {
|
||||
console.log(`event_id: ${data.params.event_id}`);
|
||||
console.log(`event_location_id: ${data.params.event_location_id}`);
|
||||
}
|
||||
$events_slct.event_id = data.params.event_id;
|
||||
$events_slct.event_location_id = data.params.event_location_id;
|
||||
$effect(() => {
|
||||
log_lvl = 1;
|
||||
if (log_lvl) {
|
||||
console.log(`event_id: ${data.params.event_id}`);
|
||||
console.log(`event_location_id: ${data.params.event_location_id}`);
|
||||
}
|
||||
$events_slct.event_id = data.params.event_id;
|
||||
$events_slct.event_location_id = data.params.event_location_id;
|
||||
});
|
||||
|
||||
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li ?? [
|
||||
''
|
||||
];
|
||||
$events_slct.id_li__event_location = ae_acct.slct.id_li__event_location ?? [
|
||||
''
|
||||
];
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`$events_slct.event_location_obj_li:`,
|
||||
$events_slct.event_location_obj_li
|
||||
);
|
||||
}
|
||||
$events_slct.event_session_obj_li = ae_acct.slct.event_session_obj_li ?? [
|
||||
''
|
||||
];
|
||||
$effect(() => {
|
||||
if (ae_acct) {
|
||||
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li ?? [
|
||||
''
|
||||
];
|
||||
$events_slct.id_li__event_location = ae_acct.slct.id_li__event_location ?? [
|
||||
''
|
||||
];
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`$events_slct.event_location_obj_li:`,
|
||||
$events_slct.event_location_obj_li
|
||||
);
|
||||
}
|
||||
$events_slct.event_session_obj_li = ae_acct.slct.event_session_obj_li ?? [
|
||||
''
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
// Set the local storage values
|
||||
if (!$events_loc.launcher) {
|
||||
|
||||
@@ -105,8 +105,8 @@
|
||||
// Use noscroll and keepfocus to speed up the transition
|
||||
goto(new_url, {
|
||||
replaceState: false,
|
||||
noscroll: true,
|
||||
keepfocus: true
|
||||
noScroll: true,
|
||||
keepFocus: true
|
||||
}).then(() => {
|
||||
if (log_lvl)
|
||||
console.log(
|
||||
|
||||
Reference in New Issue
Block a user