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:
@@ -45,9 +45,11 @@
|
||||
// User, UserCheck
|
||||
} from '@lucide/svelte';
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`Clipboard component initialized with value:`, value);
|
||||
}
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(`Clipboard component initialized with value:`, value);
|
||||
}
|
||||
});
|
||||
|
||||
// Select your trigger element
|
||||
// const elemButton: HTMLButtonElement | null = document.querySelector('[data-button]');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// *** Import Svelte specific
|
||||
import { browser } from '$app/environment';
|
||||
import { goto, invalidateAll } from '$app/navigation';
|
||||
import { untrack } from 'svelte';
|
||||
import { Modal } from 'flowbite-svelte';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
@@ -36,10 +37,20 @@
|
||||
|
||||
let { log_lvl = $bindable(0), data = null, hidden = $bindable(true) }: Props = $props();
|
||||
|
||||
let url_user_id = data.url.searchParams.get('user_id');
|
||||
let url_user_key = data.url.searchParams.get('user_key'); // Reminder that "key" is the site's auth key.
|
||||
let url_user_username = data.url.searchParams.get('username');
|
||||
let url_user_email = data.url.searchParams.get('user_email');
|
||||
let url_user_id = $state(data?.url?.searchParams?.get('user_id'));
|
||||
let url_user_key = $state(data?.url?.searchParams?.get('user_key')); // Reminder that "key" is the site's auth key.
|
||||
let url_user_username = $state(data?.url?.searchParams?.get('username'));
|
||||
let url_user_email = $state(data?.url?.searchParams?.get('user_email'));
|
||||
|
||||
$effect(() => {
|
||||
// NOTE: Sync URL params to state.
|
||||
// We use untrack to prevent infinite loops if navigation triggers within this effect.
|
||||
// WARNING: Ensure this doesn't clobber user-entered data during background URL updates.
|
||||
url_user_id = data?.url?.searchParams?.get('user_id');
|
||||
url_user_key = data?.url?.searchParams?.get('user_key');
|
||||
url_user_username = data?.url?.searchParams?.get('username');
|
||||
url_user_email = data?.url?.searchParams?.get('user_email');
|
||||
});
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
@@ -165,24 +176,28 @@
|
||||
console.log('Signed out successfully.');
|
||||
}
|
||||
|
||||
if (browser) {
|
||||
if (url_user_id) {
|
||||
// Pre-fill the auth__entered_user_id if passed in via the URL.
|
||||
$ae_sess.auth__entered_user_id = url_user_id;
|
||||
$effect(() => {
|
||||
if (browser) {
|
||||
untrack(() => {
|
||||
if (url_user_id) {
|
||||
// Pre-fill the auth__entered_user_id if passed in via the URL.
|
||||
$ae_sess.auth__entered_user_id = url_user_id;
|
||||
}
|
||||
if (url_user_key) {
|
||||
// Pre-fill the auth__entered_key if passed in via the URL.
|
||||
$ae_sess.auth__entered_user_key = url_user_key;
|
||||
}
|
||||
if (url_user_username) {
|
||||
// Pre-fill the auth__entered_username if passed in via the URL.
|
||||
$ae_sess.auth__entered_username = url_user_username;
|
||||
}
|
||||
if (url_user_email) {
|
||||
// Pre-fill the auth__entered_email if passed in via the URL.
|
||||
$ae_sess.auth__entered_email = url_user_email;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (url_user_key) {
|
||||
// Pre-fill the auth__entered_key if passed in via the URL.
|
||||
$ae_sess.auth__entered_user_key = url_user_key;
|
||||
}
|
||||
if (url_user_username) {
|
||||
// Pre-fill the auth__entered_username if passed in via the URL.
|
||||
$ae_sess.auth__entered_username = url_user_username;
|
||||
}
|
||||
if (url_user_email) {
|
||||
// Pre-fill the auth__entered_email if passed in via the URL.
|
||||
$ae_sess.auth__entered_email = url_user_email;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Use core_func.send_email_auth_ae_obj__user_id
|
||||
function handle_send_auth_email({ user_id }: { user_id: string }) {
|
||||
|
||||
@@ -116,7 +116,7 @@ max-w-max -->
|
||||
duration-500 hover:duration-200
|
||||
ease-in-out
|
||||
"
|
||||
class:top-0={expand && 1 == 3}
|
||||
class:top-0={expand && (1 as any) == 3}
|
||||
class:opacity-100={expand}
|
||||
class:w-full={expand}
|
||||
class:hidden={hide}
|
||||
|
||||
Reference in New Issue
Block a user