Fix infinite hydration loop and stabilize global store synchronization
- Refactored layouts to derive account data from stable props instead of reactive stores. - Wrapped store updates in untrack() with deep equality guards to prevent infinite re-renders. - Resolved duplicate untrack declarations and missing imports across the project. - Added fetch safeguards to Element_data_store to prevent redundant API calls. - Standardized hydration patterns to break circular dependencies during initial load.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
// Imports
|
||||
import { untrack } from 'svelte';
|
||||
// Imports
|
||||
// Import components and elements
|
||||
import * as Lucide from 'lucide-svelte';
|
||||
import Element_input_files_tbl from '$lib/elements/element_input_files_tbl.svelte';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
/**
|
||||
* AE_Comp_Site_Config_Editor.svelte
|
||||
* Specialized UI for managing site.cfg_json settings.
|
||||
* Supports General, AI, Performance, and IDAA-specific configurations.
|
||||
*/
|
||||
import { Modal } from 'flowbite-svelte';
|
||||
import { untrack } from 'svelte';
|
||||
import {
|
||||
Palette, Mail, Brain, Timer,
|
||||
ShieldCheck, CodeXml, Save,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
// *** 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
|
||||
@@ -46,10 +46,12 @@
|
||||
// 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');
|
||||
untrack(() => {
|
||||
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 = {};
|
||||
|
||||
@@ -156,6 +156,7 @@
|
||||
});
|
||||
|
||||
async function load_data_store() {
|
||||
if (ds_loading_status === 'loading') return;
|
||||
ds_loading_status = 'loading';
|
||||
const api_cfg = untrack(() => $ae_api);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user