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:
Scott Idem
2026-02-08 17:15:20 -05:00
parent 88bc18cf15
commit 718de1457d
33 changed files with 455 additions and 1567 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
// Imports
import { untrack } from 'svelte'; import { untrack } from 'svelte';
// Imports
// Import components and elements // Import components and elements
import * as Lucide from 'lucide-svelte'; import * as Lucide from 'lucide-svelte';
import Element_input_files_tbl from '$lib/elements/element_input_files_tbl.svelte'; import Element_input_files_tbl from '$lib/elements/element_input_files_tbl.svelte';

View File

@@ -1,11 +1,11 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
/** /**
* AE_Comp_Site_Config_Editor.svelte * AE_Comp_Site_Config_Editor.svelte
* Specialized UI for managing site.cfg_json settings. * Specialized UI for managing site.cfg_json settings.
* Supports General, AI, Performance, and IDAA-specific configurations. * Supports General, AI, Performance, and IDAA-specific configurations.
*/ */
import { Modal } from 'flowbite-svelte'; import { Modal } from 'flowbite-svelte';
import { untrack } from 'svelte';
import { import {
Palette, Mail, Brain, Timer, Palette, Mail, Brain, Timer,
ShieldCheck, CodeXml, Save, ShieldCheck, CodeXml, Save,

View File

@@ -1,8 +1,8 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
// *** Import Svelte specific // *** Import Svelte specific
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import { goto, invalidateAll } from '$app/navigation'; import { goto, invalidateAll } from '$app/navigation';
import { untrack } from 'svelte';
import { Modal } from 'flowbite-svelte'; import { Modal } from 'flowbite-svelte';
// *** Import other supporting libraries // *** Import other supporting libraries
@@ -46,10 +46,12 @@
// NOTE: Sync URL params to state. // NOTE: Sync URL params to state.
// We use untrack to prevent infinite loops if navigation triggers within this effect. // 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. // WARNING: Ensure this doesn't clobber user-entered data during background URL updates.
url_user_id = data?.url?.searchParams?.get('user_id'); untrack(() => {
url_user_key = data?.url?.searchParams?.get('user_key'); url_user_id = data?.url?.searchParams?.get('user_id');
url_user_username = data?.url?.searchParams?.get('username'); url_user_key = data?.url?.searchParams?.get('user_key');
url_user_email = data?.url?.searchParams?.get('user_email'); url_user_username = data?.url?.searchParams?.get('username');
url_user_email = data?.url?.searchParams?.get('user_email');
});
}); });
let ae_promises: key_val = {}; let ae_promises: key_val = {};

View File

@@ -156,6 +156,7 @@
}); });
async function load_data_store() { async function load_data_store() {
if (ds_loading_status === 'loading') return;
ds_loading_status = 'loading'; ds_loading_status = 'loading';
const api_cfg = untrack(() => $ae_api); const api_cfg = untrack(() => $ae_api);

File diff suppressed because it is too large Load Diff

View File

@@ -44,7 +44,7 @@
// Variables // Variables
$slct.account_id = data.account_id; $slct.account_id = data.account_id;
let ae_acct = data[$slct.account_id]; let ae_acct = data[data.account_id];
$ae_loc.url_origin = data.url.origin; $ae_loc.url_origin = data.url.origin;

View File

@@ -3,6 +3,7 @@
let log_lvl: number = $state(0); let log_lvl: number = $state(0);
// *** Import Svelte specific // *** Import Svelte specific
import { untrack } from 'svelte';
// import { browser } from '$app/environment'; // import { browser } from '$app/environment';
import { goto, invalidateAll } from '$app/navigation'; import { goto, invalidateAll } from '$app/navigation';
@@ -36,23 +37,27 @@
let { data, children }: Props = $props(); let { data, children }: Props = $props();
$events_loc.qry__enabled = 'enabled'; // Use effects for store initializations to prevent render-phase updates
$events_loc.qry__hidden = 'not_hidden'; $effect(() => {
$events_loc.qry__limit = 15; untrack(() => {
$events_loc.qry__offset = 0; $events_loc.qry__enabled = 'enabled';
$events_loc.qry__hidden = 'not_hidden';
$events_loc.qry__limit = 15;
$events_loc.qry__offset = 0;
});
});
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. // 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 = $derived(data[data.account_id]);
console.log(`$slct.account_id = `, $slct.account_id);
if (log_lvl) {
console.log(`$slct.account_id = `, $slct.account_id);
}
let ae_acct = data[$slct.account_id];
// console.log(`ae_acct = `, ae_acct);
$events_slct.event_id = ae_acct.slct.event_id; $effect(() => {
// $events_slct.event_obj = ae_acct.slct.event_obj; if (ae_acct) {
$events_slct.event_obj_li = ae_acct.slct.event_obj_li; untrack(() => {
$events_slct.event_id = ae_acct.slct.event_id;
$events_slct.event_obj_li = ae_acct.slct.event_obj_li;
});
}
});
let ae_promises: key_val = {}; let ae_promises: key_val = {};

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
interface Props { interface Props {
/** @type {import('./$types').PageData} */ /** @type {import('./$types').PageData} */
data: any; data: any;
@@ -8,7 +9,6 @@
let { data, log_lvl = $bindable(1) }: Props = $props(); let { data, log_lvl = $bindable(1) }: Props = $props();
// *** Import Svelte specific // *** Import Svelte specific
import { untrack } from 'svelte';
// *** Import other supporting libraries // *** Import other supporting libraries
import { liveQuery } from 'dexie'; import { liveQuery } from 'dexie';

View File

@@ -1,8 +1,8 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
import type { key_val } from '$lib/stores/ae_stores'; import type { key_val } from '$lib/stores/ae_stores';
import { events_func } from '$lib/ae_events_functions'; import { events_func } from '$lib/ae_events_functions';
import { ae_api } from '$lib/stores/ae_stores'; import { ae_api } from '$lib/stores/ae_stores';
import { untrack } from 'svelte';
interface Props { interface Props {
event_id: string; event_id: string;

View File

@@ -9,6 +9,7 @@
let { data, children }: Props = $props(); let { data, children }: Props = $props();
// *** Import Svelte specific // *** Import Svelte specific
import { untrack } from 'svelte';
// import { onMount, tick } from 'svelte'; // import { onMount, tick } from 'svelte';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { sineIn } from 'svelte/easing'; import { sineIn } from 'svelte/easing';
@@ -56,7 +57,9 @@
import Element_websocket_v2 from '$lib/elements/element_websocket_v2.svelte'; import Element_websocket_v2 from '$lib/elements/element_websocket_v2.svelte';
// *** Set initial variables // *** Set initial variables
let ae_acct = $derived(data[$slct.account_id]); // NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
// to prevent circular dependency loops during hydration.
let ae_acct = $derived(data[data.account_id]);
import { online } from 'svelte/reactivity/window'; import { online } from 'svelte/reactivity/window';
@@ -83,33 +86,41 @@
`event_session_id: ${data.url.searchParams.get('session_id')}` `event_session_id: ${data.url.searchParams.get('session_id')}`
); );
} }
$events_slct.event_id = data.params.event_id; untrack(() => {
$events_slct.event_location_id = data.params.event_location_id; $events_slct.event_id = data.params.event_id;
$events_slct.event_session_id = data.url.searchParams.get('session_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 // String-Only ID Vision: Sync the device ID from the native environment
const native_dev = $derived($ae_loc.native_device); const native_dev = $derived($ae_loc.native_device);
$effect(() => { $effect(() => {
if (native_dev) { if (native_dev) {
$events_slct.event_device_id = untrack(() => {
native_dev.event_device_id || $events_slct.event_device_id =
native_dev.id || native_dev.event_device_id ||
native_dev.event_device_id_random || native_dev.id ||
native_dev.id_random; native_dev.event_device_id_random ||
native_dev.id_random;
});
} }
}); });
$effect(() => { $effect(() => {
if (ae_acct) { if (ae_acct) {
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li ?? [ untrack(() => {
'' const new_location_obj_li = ae_acct.slct.event_location_obj_li ?? [''];
]; if (JSON.stringify($events_slct.event_location_obj_li) !== JSON.stringify(new_location_obj_li)) {
$events_slct.event_location_obj_li = new_location_obj_li;
}
const new_id_li__event_location = ae_acct.slct.id_li__event_location ?? [''];
if (JSON.stringify($events_slct.id_li__event_location) !== JSON.stringify(new_id_li__event_location)) {
$events_slct.id_li__event_location = new_id_li__event_location;
}
});
} }
}); });
$events_slct.id_li__event_location = ae_acct.slct.id_li__event_location ?? [
''
];
// *** Functions and Logic // *** Functions and Logic

View File

@@ -8,6 +8,7 @@
let log_lvl: number = $state(0); let log_lvl: number = $state(0);
// Imports // Imports
import { untrack } from 'svelte';
import { import {
ae_snip, ae_snip,
ae_loc, ae_loc,
@@ -37,7 +38,9 @@
// Variables // Variables
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. // Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
let ae_acct = $derived(data[$slct.account_id]); // NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
// to prevent circular dependency loops during hydration.
let ae_acct = $derived(data[data.account_id]);
// $ae_loc.url_origin = data.url.origin; // $ae_loc.url_origin = data.url.origin;
@@ -47,27 +50,31 @@
console.log(`event_id: ${data.params.event_id}`); console.log(`event_id: ${data.params.event_id}`);
console.log(`event_location_id: ${data.params.event_location_id}`); console.log(`event_location_id: ${data.params.event_location_id}`);
} }
$events_slct.event_id = data.params.event_id; untrack(() => {
$events_slct.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(() => { $effect(() => {
if (ae_acct) { if (ae_acct) {
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li ?? [ untrack(() => {
'' $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 ?? [ ];
'' $events_slct.id_li__event_location = ae_acct.slct.id_li__event_location ?? [
]; ''
if (log_lvl) { ];
console.log( if (log_lvl) {
`$events_slct.event_location_obj_li:`, console.log(
$events_slct.event_location_obj_li `$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 ?? [ }
'' $events_slct.event_session_obj_li = ae_acct.slct.event_session_obj_li ?? [
]; ''
];
});
} }
}); });

View File

@@ -51,7 +51,7 @@
} }
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. // 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; $ae_loc.url_origin = data.url.origin;

View File

@@ -55,7 +55,7 @@
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. // Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
// $slct.account_id = data.account_id; // $slct.account_id = data.account_id;
// console.log(`$slct.account_id = `, $slct.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(`ae_acct = `, ae_acct);
$ae_loc.url_origin = data.url.origin; $ae_loc.url_origin = data.url.origin;

View File

@@ -46,7 +46,7 @@
// Variables // Variables
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. // Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
// $slct.account_id = data.account_id; // $slct.account_id = data.account_id;
let ae_acct = data[$slct.account_id]; let ae_acct = data[data.account_id];
if (log_lvl) { if (log_lvl) {
console.log(`ae_acct = `, ae_acct); console.log(`ae_acct = `, ae_acct);
} }

View File

@@ -42,7 +42,7 @@
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. // Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
// $slct.account_id = data.account_id; // $slct.account_id = data.account_id;
console.log(`$slct.account_id = `, $slct.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(`ae_acct = `, ae_acct);
// console.log(`TEST data`, data); // console.log(`TEST data`, data);

View File

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

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
interface Props { interface Props {
/** @type {import('./$types').LayoutData} */ /** @type {import('./$types').LayoutData} */
data: any; data: any;
@@ -27,7 +28,9 @@
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. // Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
// $slct.account_id = data.account_id; // $slct.account_id = data.account_id;
let ae_acct = $derived(data[$slct.account_id]); // NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
// to prevent circular dependency loops during hydration.
let ae_acct = $derived(data[data.account_id]);
$effect(() => { $effect(() => {
if (log_lvl) { if (log_lvl) {
@@ -43,8 +46,14 @@
$effect(() => { $effect(() => {
if (ae_acct) { if (ae_acct) {
$events_slct.event_session_obj_li = ae_acct.slct.event_session_obj_li; untrack(() => {
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li; if (JSON.stringify($events_slct.event_session_obj_li) !== JSON.stringify(ae_acct.slct.event_session_obj_li)) {
$events_slct.event_session_obj_li = ae_acct.slct.event_session_obj_li;
}
if (JSON.stringify($events_slct.event_location_obj_li) !== JSON.stringify(ae_acct.slct.event_location_obj_li)) {
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li;
}
});
} }
}); });
</script> </script>

View File

@@ -39,12 +39,16 @@
import Event_page_menu from './event_page_menu.svelte'; import Event_page_menu from './event_page_menu.svelte';
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. // Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
let ae_acct = $derived(data[$slct.account_id]); // NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
// to prevent circular dependency loops during hydration.
let ae_acct = $derived(data[data.account_id]);
let event_id = $derived(data.params.event_id); let event_id = $derived(data.params.event_id);
$effect(() => { $effect(() => {
if (ae_acct) { if (ae_acct) {
$events_slct.event_id = ae_acct.slct.event_id; untrack(() => {
$events_slct.event_id = ae_acct.slct.event_id;
});
} }
}); });
@@ -74,11 +78,15 @@
// JSON formatted configuration options for an event, and specifically for the presentation management module. // JSON formatted configuration options for an event, and specifically for the presentation management module.
$effect(() => { $effect(() => {
if ($lq__event_obj?.mod_pres_mgmt_json) { const remote_cfg = $lq__event_obj?.mod_pres_mgmt_json;
events_func.sync_config__event_pres_mgmt({ const local_cfg = $events_loc.pres_mgmt;
pres_mgmt_cfg_remote: $lq__event_obj.mod_pres_mgmt_json, if (remote_cfg && local_cfg) {
pres_mgmt_cfg_local: $events_loc.pres_mgmt, untrack(() => {
log_lvl: log_lvl events_func.sync_config__event_pres_mgmt({
pres_mgmt_cfg_remote: remote_cfg,
pres_mgmt_cfg_local: local_cfg,
log_lvl: log_lvl
});
}); });
} }
}); });

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
let log_lvl: number = 2; let log_lvl: number = 2;
// *** Import Svelte specific // *** Import Svelte specific
@@ -29,8 +30,10 @@
let { data, children }: Props = $props(); let { data, children }: Props = $props();
$effect(() => { $effect(() => {
$ae_loc.url_origin = data.url.origin; untrack(() => {
$ae_loc.params = data.params; $ae_loc.url_origin = data.url.origin;
$ae_loc.params = data.params;
});
if (log_lvl > 1) { if (log_lvl > 1) {
console.log(`+layout.svelte data:`, data); console.log(`+layout.svelte data:`, data);
@@ -39,111 +42,113 @@
$effect(() => { $effect(() => {
if (browser) { if (browser) {
if (data.url.searchParams.get('uuid')) { untrack(() => {
$idaa_loc.novi_uuid = data.url.searchParams.get('uuid'); // data.params.uuid; if (data.url.searchParams.get('uuid')) {
} $idaa_loc.novi_uuid = data.url.searchParams.get('uuid'); // data.params.uuid;
if (data.url.searchParams.get('email')) { }
$idaa_loc.novi_email = decodeURIComponent(data.url.searchParams.get('email')); if (data.url.searchParams.get('email')) {
} else { $idaa_loc.novi_email = decodeURIComponent(data.url.searchParams.get('email'));
$idaa_loc.novi_email = null; } else {
} $idaa_loc.novi_email = null;
if (data.url.searchParams.get('full_name')) { }
$idaa_loc.novi_full_name = decodeURIComponent(data.url.searchParams.get('full_name')); if (data.url.searchParams.get('full_name')) {
} else { $idaa_loc.novi_full_name = decodeURIComponent(data.url.searchParams.get('full_name'));
$idaa_loc.novi_full_name = null; } else {
} $idaa_loc.novi_full_name = null;
$idaa_loc.novi_admin_li = $ae_loc.site_cfg_json?.novi_admin_li ?? []; }
$idaa_loc.novi_trusted_li = $ae_loc.site_cfg_json?.novi_trusted_li ?? []; $idaa_loc.novi_admin_li = $ae_loc.site_cfg_json?.novi_admin_li ?? [];
// console.log(`$idaa_loc.novi_uuid:`, $idaa_loc.novi_uuid); $idaa_loc.novi_trusted_li = $ae_loc.site_cfg_json?.novi_trusted_li ?? [];
// console.log(`$idaa_loc.novi_admin_li:`, $idaa_loc.novi_admin_li); // console.log(`$idaa_loc.novi_uuid:`, $idaa_loc.novi_uuid);
// console.log(`$idaa_loc.novi_admin_li:`, $idaa_loc.novi_admin_li);
// Reminder: super > manager > administrator > trusted > public > authenticated > anonymous // Reminder: super > manager > administrator > trusted > public > authenticated > anonymous
// NOTE: This is checking if they are in an iframe *and* have a Novi UUID. We ignore the iframe mode for trusted and above (administrators, managers, etc). // NOTE: This is checking if they are in an iframe *and* have a Novi UUID. We ignore the iframe mode for trusted and above (administrators, managers, etc).
if ( if (
$ae_loc?.iframe && $ae_loc?.iframe &&
$idaa_loc?.novi_uuid?.length == 36 && $idaa_loc?.novi_uuid?.length == 36 &&
$idaa_loc?.novi_email?.length > 3 && $idaa_loc?.novi_email?.length > 3 &&
$idaa_loc?.novi_full_name?.length > 0 $idaa_loc?.novi_full_name?.length > 0
) { ) {
$ae_loc.access_type = 'authenticated'; $ae_loc.access_type = 'authenticated';
$ae_loc.super_access = false; $ae_loc.super_access = false;
$ae_loc.manager_access = false; $ae_loc.manager_access = false;
$ae_loc.administrator_access = false; $ae_loc.administrator_access = false;
$ae_loc.trusted_access = false; $ae_loc.trusted_access = false;
$ae_loc.public_access = false; $ae_loc.public_access = false;
$ae_loc.authenticated_access = true; $ae_loc.authenticated_access = true;
$ae_loc.anonymous_access = true; $ae_loc.anonymous_access = true;
// Resetting these just in case... // Resetting these just in case...
$idaa_loc.bb.qry__hidden == 'not_hidden'; $idaa_loc.bb.qry__hidden == 'not_hidden';
$idaa_loc.bb.qry__enabled == 'enabled'; $idaa_loc.bb.qry__enabled == 'enabled';
// NOTE: This is sort of temporary while we work on getting Jisti working with IDAA's Novi site. // NOTE: This is sort of temporary while we work on getting Jisti working with IDAA's Novi site.
} else if ( } else if (
$ae_loc?.iframe && $ae_loc?.iframe &&
$idaa_loc?.novi_uuid?.length == 36 $idaa_loc?.novi_uuid?.length == 36
) { ) {
$ae_loc.access_type = 'authenticated'; $ae_loc.access_type = 'authenticated';
$ae_loc.super_access = false; $ae_loc.super_access = false;
$ae_loc.manager_access = false; $ae_loc.manager_access = false;
$ae_loc.administrator_access = false; $ae_loc.administrator_access = false;
$ae_loc.trusted_access = false; $ae_loc.trusted_access = false;
$ae_loc.public_access = false; $ae_loc.public_access = false;
$ae_loc.authenticated_access = true; $ae_loc.authenticated_access = true;
$ae_loc.anonymous_access = true; $ae_loc.anonymous_access = true;
// Resetting these just in case... // Resetting these just in case...
$idaa_loc.bb.qry__hidden == 'not_hidden'; $idaa_loc.bb.qry__hidden == 'not_hidden';
$idaa_loc.bb.qry__enabled == 'enabled'; $idaa_loc.bb.qry__enabled == 'enabled';
} else if ($ae_loc?.iframe) { } else if ($ae_loc?.iframe) {
$ae_loc.access_type = 'anonymous'; $ae_loc.access_type = 'anonymous';
$ae_loc.super_access = false; $ae_loc.super_access = false;
$ae_loc.manager_access = false; $ae_loc.manager_access = false;
$ae_loc.administrator_access = false; $ae_loc.administrator_access = false;
$ae_loc.trusted_access = false; $ae_loc.trusted_access = false;
$ae_loc.public_access = false; $ae_loc.public_access = false;
$ae_loc.authenticated_access = false; $ae_loc.authenticated_access = false;
$ae_loc.anonymous_access = true; $ae_loc.anonymous_access = true;
// Resetting these just in case... // Resetting these just in case...
$idaa_loc.bb.qry__hidden == 'not_hidden'; $idaa_loc.bb.qry__hidden == 'not_hidden';
$idaa_loc.bb.qry__enabled == 'enabled'; $idaa_loc.bb.qry__enabled == 'enabled';
}
if ($idaa_loc.novi_uuid) {
let flag = false;
// NOTE: Check if the novi_uuid is in the novi_admin_li list
if ($idaa_loc.novi_admin_li) {
if ($idaa_loc.novi_admin_li.includes($idaa_loc.novi_uuid)) {
$ae_loc.access_type = 'administrator';
$ae_loc.super_access = false;
$ae_loc.manager_access = false;
$ae_loc.administrator_access = true;
$ae_loc.trusted_access = true;
$ae_loc.public_access = true;
$ae_loc.authenticated_access = true;
$ae_loc.anonymous_access = true;
flag = true;
}
} }
// NOTE: Check if the novi_uuid is in the novi_trusted_li list if ($idaa_loc.novi_uuid) {
if ($idaa_loc.novi_trusted_li) { let flag = false;
if ($idaa_loc.novi_trusted_li.includes($idaa_loc.novi_uuid)) { // NOTE: Check if the novi_uuid is in the novi_admin_li list
$ae_loc.access_type = 'trusted'; if ($idaa_loc.novi_admin_li) {
$ae_loc.super_access = false; if ($idaa_loc.novi_admin_li.includes($idaa_loc.novi_uuid)) {
$ae_loc.manager_access = false; $ae_loc.access_type = 'administrator';
$ae_loc.administrator_access = false; $ae_loc.super_access = false;
$ae_loc.trusted_access = true; $ae_loc.manager_access = false;
$ae_loc.public_access = true; $ae_loc.administrator_access = true;
$ae_loc.authenticated_access = true; $ae_loc.trusted_access = true;
$ae_loc.anonymous_access = true; $ae_loc.public_access = true;
$ae_loc.authenticated_access = true;
$ae_loc.anonymous_access = true;
flag = true; flag = true;
}
}
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
if ($idaa_loc.novi_trusted_li) {
if ($idaa_loc.novi_trusted_li.includes($idaa_loc.novi_uuid)) {
$ae_loc.access_type = 'trusted';
$ae_loc.super_access = false;
$ae_loc.manager_access = false;
$ae_loc.administrator_access = false;
$ae_loc.trusted_access = true;
$ae_loc.public_access = true;
$ae_loc.authenticated_access = true;
$ae_loc.anonymous_access = true;
flag = true;
}
} }
} }
} });
} }
}); });

View File

@@ -1,6 +1,9 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
let log_lvl: number = 0; let log_lvl: number = 0;
// *** Import Svelte specific
// *** Import Aether specific variables and functions // *** Import Aether specific variables and functions
import { import {
ae_snip, ae_snip,
@@ -21,7 +24,9 @@
let { data, children }: Props = $props(); let { data, children }: Props = $props();
let ae_acct = $derived(data[$slct.account_id]); // NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
// to prevent circular dependency loops during hydration.
let ae_acct = $derived(data[data.account_id]);
$effect(() => { $effect(() => {
if (log_lvl > 1) { if (log_lvl > 1) {
@@ -38,7 +43,9 @@
} }
if (ae_acct) { if (ae_acct) {
$idaa_slct.archive_obj_li = ae_acct.slct.archive_obj_li; untrack(() => {
$idaa_slct.archive_obj_li = ae_acct.slct.archive_obj_li;
});
} }
}); });
// $idaa_slct.archive_id = ae_acct.slct.archive_id; // Not set here yet. // $idaa_slct.archive_id = ae_acct.slct.archive_id; // Not set here yet.

View File

@@ -52,7 +52,7 @@
// let ae_triggers: key_val = {}; // let ae_triggers: key_val = {};
// *** Quickly pull out data from parent(s) // *** Quickly pull out data from parent(s)
let ae_acct = data[$slct.account_id]; let ae_acct = data[data.account_id];
if (log_lvl) { if (log_lvl) {
console.log(`ae_acct = `, ae_acct); console.log(`ae_acct = `, ae_acct);
} }

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
let log_lvl: number = $state(0); let log_lvl: number = $state(0);
// *** Import Svelte specific // *** Import Svelte specific
@@ -31,7 +32,9 @@
let { data, children }: Props = $props(); let { data, children }: Props = $props();
let ae_acct = $derived(data[$slct.account_id]); // NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
// to prevent circular dependency loops during hydration.
let ae_acct = $derived(data[data.account_id]);
$effect(() => { $effect(() => {
if (log_lvl > 1) { if (log_lvl > 1) {
@@ -48,7 +51,9 @@
} }
if (ae_acct) { if (ae_acct) {
$idaa_slct.post_obj_li = ae_acct.slct.post_obj_li; untrack(() => {
$idaa_slct.post_obj_li = ae_acct.slct.post_obj_li;
});
} }
}); });
// $idaa_slct.post_id = ae_acct.slct.post_id; // Not set here yet. // $idaa_slct.post_id = ae_acct.slct.post_id; // Not set here yet.

View File

@@ -41,7 +41,7 @@
import Comp__post_obj_id_view from '.././ae_idaa_comp__post_obj_id_view.svelte'; import Comp__post_obj_id_view from '.././ae_idaa_comp__post_obj_id_view.svelte';
// *** Quickly pull out data from parent(s) // *** Quickly pull out data from parent(s)
let ae_acct = data[$slct.account_id]; let ae_acct = data[data.account_id];
if (log_lvl) { if (log_lvl) {
console.log(`ae_acct = `, ae_acct); console.log(`ae_acct = `, ae_acct);
} }

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
let log_lvl: number = 0; let log_lvl: number = 0;
// *** Import Svelte specific // *** Import Svelte specific
@@ -31,19 +32,32 @@
let { data, children }: Props = $props(); let { data, children }: Props = $props();
if (log_lvl > 1) { // NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
console.log(`ae_idaa_recovery_meetings +layout.svelte`, data); // to prevent circular dependency loops during hydration.
} let ae_acct = $derived(data[data.account_id]);
// *** Quickly pull out data from parent(s) $effect(() => {
$slct.account_id = data.account_id; if (log_lvl > 1) {
console.log(`ae_idaa_recovery_meetings +layout.svelte`, data);
}
let ae_acct = data[$slct.account_id]; // *** Quickly pull out data from parent(s)
if (log_lvl) { untrack(() => {
console.log(`ae_acct = `, ae_acct); $slct.account_id = data.account_id;
} });
});
$idaa_slct.event_obj_li = ae_acct.slct.event_obj_li; $effect(() => {
if (log_lvl) {
console.log(`ae_acct = `, ae_acct);
}
if (ae_acct) {
untrack(() => {
$idaa_slct.event_obj_li = ae_acct.slct.event_obj_li;
});
}
});
// $idaa_slct.event_id = ae_acct.slct.event_id; // Not set here yet. // $idaa_slct.event_id = ae_acct.slct.event_id; // Not set here yet.
// *** Set initial variables // *** Set initial variables

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
interface Props { interface Props {
/** @type {import('./$types').PageData} */ /** @type {import('./$types').PageData} */
data: any; data: any;
@@ -10,7 +11,6 @@
// *** Import Svelte specific // *** Import Svelte specific
import { page } from '$app/state'; import { page } from '$app/state';
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import { untrack } from 'svelte';
// *** Import other supporting libraries // *** Import other supporting libraries
import { db_events } from '$lib/ae_events/db_events'; import { db_events } from '$lib/ae_events/db_events';

View File

@@ -42,7 +42,7 @@
import Help_tech from '$lib/app_components/e_app_help_tech.svelte'; import Help_tech from '$lib/app_components/e_app_help_tech.svelte';
// *** Quickly pull out data from parent(s) // *** Quickly pull out data from parent(s)
let ae_acct = data[$slct.account_id]; let ae_acct = data[data.account_id];
if (log_lvl) { if (log_lvl) {
console.log(`ae_acct = `, ae_acct); console.log(`ae_acct = `, ae_acct);
} }

View File

@@ -3,6 +3,7 @@
let log_lvl = $state(0); let log_lvl = $state(0);
// *** Import Svelte specific // *** Import Svelte specific
import { untrack } from 'svelte';
// import { browser } from '$app/environment'; // import { browser } from '$app/environment';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
@@ -26,23 +27,29 @@
} }
let { data, children }: Props = $props(); let { data, children }: Props = $props();
// Initialize/Reset Entry Query defaults on layout load // Use effects for store initializations to prevent render-phase updates
// $journals_loc.entry.qry__enabled = 'enabled';
// $journals_loc.entry.qry__hidden = 'not_hidden';
// $journals_loc.entry.qry__limit = 15;
// $journals_loc.entry.qry__offset = 0;
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
$slct.account_id = data.account_id;
$effect(() => { $effect(() => {
if (log_lvl) { untrack(() => {
console.log(`$slct.account_id = `, $slct.account_id); if ($slct.account_id !== data.account_id) {
$slct.account_id = data.account_id;
}
});
});
let ae_acct = $derived(data[data.account_id]);
$effect(() => {
if (ae_acct) {
untrack(() => {
if ($journals_slct.journal_id !== ae_acct.slct.journal_id) {
$journals_slct.journal_id = ae_acct.slct.journal_id;
}
if (JSON.stringify($journals_slct.journal_obj_li) !== JSON.stringify(ae_acct.slct.journal_obj_li)) {
$journals_slct.journal_obj_li = ae_acct.slct.journal_obj_li;
}
});
} }
}); });
let ae_acct = data[$slct.account_id];
$journals_slct.journal_id = ae_acct.slct.journal_id;
$journals_slct.journal_obj_li = ae_acct.slct.journal_obj_li;
let nav_y_height = $state(0); let nav_y_height = $state(0);
@@ -271,15 +278,12 @@
class:opacity-0={yTop < 750} class:opacity-0={yTop < 750}
class:ae_btn_warning_filled={yTop > 1500} class:ae_btn_warning_filled={yTop > 1500}
onclick={() => { onclick={() => {
log_lvl = 1; if (log_lvl) {
$effect(() => { console.log(
if (log_lvl) { `Scroll to top button clicked. yScroll: ${yScroll} scrollTop: ${scroll_container().scrollTop}`,
console.log( scroll_container()
`Scroll to top button clicked. yScroll: ${yScroll} scrollTop: ${scroll_container().scrollTop}`, );
scroll_container() }
);
}
});
console.log('Not Safari, using smooth scroll to top'); console.log('Not Safari, using smooth scroll to top');
document.getElementById('ae_main_content')?.scrollTo({ document.getElementById('ae_main_content')?.scrollTo({
@@ -341,15 +345,12 @@
class:opacity-0={yTop < 750} class:opacity-0={yTop < 750}
class:ae_btn_warning_filled={yTop > 1500} class:ae_btn_warning_filled={yTop > 1500}
onclick={() => { onclick={() => {
log_lvl = 1; if (log_lvl) {
$effect(() => { console.log(
if (log_lvl) { `Scroll to bottom button clicked. yScroll: ${yScroll} scrollTop: ${scroll_container().scrollTop}`,
console.log( scroll_container()
`Scroll to bottom button clicked. yScroll: ${yScroll} scrollTop: ${scroll_container().scrollTop}`, );
scroll_container() }
);
}
});
console.log('Not Safari, using smooth scroll to bottom'); console.log('Not Safari, using smooth scroll to bottom');
document.getElementById('ae_main_content')?.scrollTo({ document.getElementById('ae_main_content')?.scrollTo({

View File

@@ -24,7 +24,9 @@
import Journal_entry_obj_qry from './../ae_comp__journal_entry_obj_qry.svelte'; import Journal_entry_obj_qry from './../ae_comp__journal_entry_obj_qry.svelte';
let ae_acct = data[$slct.account_id]; // NOTE: Derived from data.account_id (prop) instead of $slct.account_id (store)
// to prevent circular dependency loops during hydration.
let ae_acct = $derived(data[data.account_id]);
$effect(() => { $effect(() => {
if (log_lvl) { if (log_lvl) {
console.log(`ae_acct = `, ae_acct); console.log(`ae_acct = `, ae_acct);

View File

@@ -43,7 +43,7 @@
import AeCompModalJournalImport from '../ae_comp__modal_journal_import.svelte'; import AeCompModalJournalImport from '../ae_comp__modal_journal_import.svelte';
// Variables // Variables
let ae_acct = data[$slct.account_id]; let ae_acct = data[data.account_id];
let show_export_modal = $state(false); let show_export_modal = $state(false);
let show_import_modal = $state(false); let show_import_modal = $state(false);

View File

@@ -47,7 +47,7 @@
// Variables // Variables
// *** Quickly pull out data from parent(s) // *** Quickly pull out data from parent(s)
let ae_acct = data[$slct.account_id]; let ae_acct = data[data.account_id];
let show_export_modal = $state(false); let show_export_modal = $state(false);
$effect(() => { $effect(() => {

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
/** /**
* ae_comp__journal_entry_obj_id_view.svelte * ae_comp__journal_entry_obj_id_view.svelte
* Reference Implementation for Journal Entry View/Edit * Reference Implementation for Journal Entry View/Edit
@@ -8,7 +9,6 @@
// *** Import Svelte core // *** Import Svelte core
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { untrack } from 'svelte';
// *** Import secondary libraries // *** Import secondary libraries
import { marked } from 'marked'; import { marked } from 'marked';

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
/** /**
* ae_comp__journal_obj_id_edit.svelte * ae_comp__journal_obj_id_edit.svelte
* Standardized Journal-level configuration. * Standardized Journal-level configuration.
@@ -41,7 +42,6 @@
} from 'lucide-svelte'; } from 'lucide-svelte';
import { Modal } from 'flowbite-svelte'; import { Modal } from 'flowbite-svelte';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { untrack } from 'svelte';
// *** Import Aether specific variables and functions // *** Import Aether specific variables and functions
import { ae_loc, ae_api } from '$lib/stores/ae_stores'; import { ae_loc, ae_api } from '$lib/stores/ae_stores';

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { untrack } from 'svelte';
/** /**
* ae_comp__modal_journal_config.svelte * ae_comp__modal_journal_config.svelte
* Standardized Module-level settings for Journals. * Standardized Module-level settings for Journals.
@@ -19,7 +20,6 @@
Wrench Wrench
} from 'lucide-svelte'; } from 'lucide-svelte';
import { Modal } from 'flowbite-svelte'; import { Modal } from 'flowbite-svelte';
import { untrack } from 'svelte';
// *** Import Aether specific variables and functions // *** Import Aether specific variables and functions
import { ae_loc, ae_api } from '$lib/stores/ae_stores'; import { ae_loc, ae_api } from '$lib/stores/ae_stores';