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:
@@ -51,7 +51,7 @@
|
||||
}
|
||||
|
||||
// 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 = data[data.account_id];
|
||||
|
||||
$ae_loc.url_origin = data.url.origin;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||
// $slct.account_id = data.account_id;
|
||||
// console.log(`$slct.account_id = `, $slct.account_id);
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = data[data.account_id];
|
||||
// console.log(`ae_acct = `, ae_acct);
|
||||
|
||||
$ae_loc.url_origin = data.url.origin;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
// Variables
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||
// $slct.account_id = data.account_id;
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = data[data.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||
// $slct.account_id = data.account_id;
|
||||
console.log(`$slct.account_id = `, $slct.account_id);
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = data[data.account_id];
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
|
||||
// console.log(`TEST data`, data);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
interface Props {
|
||||
/** @type {import('./$types').PageData} */
|
||||
data: any;
|
||||
@@ -58,7 +59,7 @@
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||
// $slct.account_id = data.account_id;
|
||||
// console.log(`$slct.account_id = `, $slct.account_id);
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = data[data.account_id];
|
||||
// console.log(`ae_acct = `, ae_acct);
|
||||
|
||||
$ae_loc.url_origin = data.url.origin;
|
||||
@@ -155,18 +156,13 @@
|
||||
// JSON formatted configuration options for an event, and specifically for the presentation management module.
|
||||
$effect(() => {
|
||||
if ($lq__event_obj?.mod_pres_mgmt_json) {
|
||||
// if (log_lvl) {
|
||||
// console.log(`*** Event Pres Mgmt JSON *** pres_mgmt_cfg_local`, $events_loc.pres_mgmt);
|
||||
// }
|
||||
// $events_loc.pres_mgmt =
|
||||
events_func.sync_config__event_pres_mgmt({
|
||||
pres_mgmt_cfg_remote: $lq__event_obj?.mod_pres_mgmt_json,
|
||||
pres_mgmt_cfg_local: $events_loc?.pres_mgmt,
|
||||
log_lvl: log_lvl
|
||||
untrack(() => {
|
||||
events_func.sync_config__event_pres_mgmt({
|
||||
pres_mgmt_cfg_remote: $lq__event_obj?.mod_pres_mgmt_json,
|
||||
pres_mgmt_cfg_local: $events_loc?.pres_mgmt,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
});
|
||||
// if (log_lvl) {
|
||||
// console.log(`*** Event Pres Mgmt JSON *** pres_mgmt_cfg_local`, $events_loc.pres_mgmt);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user