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);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@
|
||||
|
||||
// Variables
|
||||
$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;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
let log_lvl: number = $state(0);
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { untrack } from 'svelte';
|
||||
// import { browser } from '$app/environment';
|
||||
import { goto, invalidateAll } from '$app/navigation';
|
||||
|
||||
@@ -36,23 +37,27 @@
|
||||
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
$events_loc.qry__enabled = 'enabled';
|
||||
$events_loc.qry__hidden = 'not_hidden';
|
||||
$events_loc.qry__limit = 15;
|
||||
$events_loc.qry__offset = 0;
|
||||
// Use effects for store initializations to prevent render-phase updates
|
||||
$effect(() => {
|
||||
untrack(() => {
|
||||
$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.
|
||||
// $slct.account_id = 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);
|
||||
let ae_acct = $derived(data[data.account_id]);
|
||||
|
||||
$events_slct.event_id = ae_acct.slct.event_id;
|
||||
// $events_slct.event_obj = ae_acct.slct.event_obj;
|
||||
$events_slct.event_obj_li = ae_acct.slct.event_obj_li;
|
||||
$effect(() => {
|
||||
if (ae_acct) {
|
||||
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 = {};
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
interface Props {
|
||||
/** @type {import('./$types').PageData} */
|
||||
data: any;
|
||||
@@ -8,7 +9,6 @@
|
||||
let { data, log_lvl = $bindable(1) }: Props = $props();
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
import { liveQuery } from 'dexie';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
import { ae_api } from '$lib/stores/ae_stores';
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
event_id: string;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { untrack } from 'svelte';
|
||||
// import { onMount, tick } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { sineIn } from 'svelte/easing';
|
||||
@@ -56,7 +57,9 @@
|
||||
import Element_websocket_v2 from '$lib/elements/element_websocket_v2.svelte';
|
||||
|
||||
// *** 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';
|
||||
|
||||
@@ -83,33 +86,41 @@
|
||||
`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');
|
||||
untrack(() => {
|
||||
$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 = $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;
|
||||
untrack(() => {
|
||||
$events_slct.event_device_id =
|
||||
native_dev.event_device_id ||
|
||||
native_dev.id ||
|
||||
native_dev.event_device_id_random ||
|
||||
native_dev.id_random;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
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
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
let log_lvl: number = $state(0);
|
||||
|
||||
// Imports
|
||||
import { untrack } from 'svelte';
|
||||
import {
|
||||
ae_snip,
|
||||
ae_loc,
|
||||
@@ -37,7 +38,9 @@
|
||||
|
||||
// Variables
|
||||
// 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;
|
||||
|
||||
@@ -47,27 +50,31 @@
|
||||
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;
|
||||
untrack(() => {
|
||||
$events_slct.event_id = data.params.event_id;
|
||||
$events_slct.event_location_id = data.params.event_location_id;
|
||||
});
|
||||
});
|
||||
|
||||
$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 ?? [
|
||||
''
|
||||
];
|
||||
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 ?? [
|
||||
''
|
||||
];
|
||||
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 ?? [
|
||||
''
|
||||
];
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
interface Props {
|
||||
/** @type {import('./$types').LayoutData} */
|
||||
data: any;
|
||||
@@ -27,7 +28,9 @@
|
||||
|
||||
// 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[$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(() => {
|
||||
if (log_lvl) {
|
||||
@@ -43,8 +46,14 @@
|
||||
|
||||
$effect(() => {
|
||||
if (ae_acct) {
|
||||
$events_slct.event_session_obj_li = ae_acct.slct.event_session_obj_li;
|
||||
$events_slct.event_location_obj_li = ae_acct.slct.event_location_obj_li;
|
||||
untrack(() => {
|
||||
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>
|
||||
|
||||
@@ -39,12 +39,16 @@
|
||||
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.
|
||||
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);
|
||||
|
||||
$effect(() => {
|
||||
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.
|
||||
$effect(() => {
|
||||
if ($lq__event_obj?.mod_pres_mgmt_json) {
|
||||
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
|
||||
const remote_cfg = $lq__event_obj?.mod_pres_mgmt_json;
|
||||
const local_cfg = $events_loc.pres_mgmt;
|
||||
if (remote_cfg && local_cfg) {
|
||||
untrack(() => {
|
||||
events_func.sync_config__event_pres_mgmt({
|
||||
pres_mgmt_cfg_remote: remote_cfg,
|
||||
pres_mgmt_cfg_local: local_cfg,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
let log_lvl: number = 2;
|
||||
|
||||
// *** Import Svelte specific
|
||||
@@ -29,8 +30,10 @@
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
$effect(() => {
|
||||
$ae_loc.url_origin = data.url.origin;
|
||||
$ae_loc.params = data.params;
|
||||
untrack(() => {
|
||||
$ae_loc.url_origin = data.url.origin;
|
||||
$ae_loc.params = data.params;
|
||||
});
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(`+layout.svelte data:`, data);
|
||||
@@ -39,111 +42,113 @@
|
||||
|
||||
$effect(() => {
|
||||
if (browser) {
|
||||
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'));
|
||||
} 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'));
|
||||
} 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 ?? [];
|
||||
// console.log(`$idaa_loc.novi_uuid:`, $idaa_loc.novi_uuid);
|
||||
// console.log(`$idaa_loc.novi_admin_li:`, $idaa_loc.novi_admin_li);
|
||||
untrack(() => {
|
||||
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'));
|
||||
} 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'));
|
||||
} 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 ?? [];
|
||||
// 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).
|
||||
if (
|
||||
$ae_loc?.iframe &&
|
||||
$idaa_loc?.novi_uuid?.length == 36 &&
|
||||
$idaa_loc?.novi_email?.length > 3 &&
|
||||
$idaa_loc?.novi_full_name?.length > 0
|
||||
) {
|
||||
$ae_loc.access_type = 'authenticated';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
// 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 (
|
||||
$ae_loc?.iframe &&
|
||||
$idaa_loc?.novi_uuid?.length == 36 &&
|
||||
$idaa_loc?.novi_email?.length > 3 &&
|
||||
$idaa_loc?.novi_full_name?.length > 0
|
||||
) {
|
||||
$ae_loc.access_type = 'authenticated';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
// NOTE: This is sort of temporary while we work on getting Jisti working with IDAA's Novi site.
|
||||
} else if (
|
||||
$ae_loc?.iframe &&
|
||||
$idaa_loc?.novi_uuid?.length == 36
|
||||
) {
|
||||
$ae_loc.access_type = 'authenticated';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
// NOTE: This is sort of temporary while we work on getting Jisti working with IDAA's Novi site.
|
||||
} else if (
|
||||
$ae_loc?.iframe &&
|
||||
$idaa_loc?.novi_uuid?.length == 36
|
||||
) {
|
||||
$ae_loc.access_type = 'authenticated';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
} else if ($ae_loc?.iframe) {
|
||||
$ae_loc.access_type = 'anonymous';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = false;
|
||||
$ae_loc.anonymous_access = true;
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
} else if ($ae_loc?.iframe) {
|
||||
$ae_loc.access_type = 'anonymous';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = false;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$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;
|
||||
}
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
}
|
||||
|
||||
// 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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
let log_lvl: number = 0;
|
||||
|
||||
// *** Import Svelte specific
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import {
|
||||
ae_snip,
|
||||
@@ -21,7 +24,9 @@
|
||||
|
||||
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(() => {
|
||||
if (log_lvl > 1) {
|
||||
@@ -38,7 +43,9 @@
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
// let ae_triggers: key_val = {};
|
||||
|
||||
// *** Quickly pull out data from parent(s)
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = data[data.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
let log_lvl: number = $state(0);
|
||||
|
||||
// *** Import Svelte specific
|
||||
@@ -31,7 +32,9 @@
|
||||
|
||||
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(() => {
|
||||
if (log_lvl > 1) {
|
||||
@@ -48,7 +51,9 @@
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
import Comp__post_obj_id_view from '.././ae_idaa_comp__post_obj_id_view.svelte';
|
||||
|
||||
// *** Quickly pull out data from parent(s)
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = data[data.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
let log_lvl: number = 0;
|
||||
|
||||
// *** Import Svelte specific
|
||||
@@ -31,19 +32,32 @@
|
||||
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(`ae_idaa_recovery_meetings +layout.svelte`, data);
|
||||
}
|
||||
// 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]);
|
||||
|
||||
// *** Quickly pull out data from parent(s)
|
||||
$slct.account_id = data.account_id;
|
||||
$effect(() => {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`ae_idaa_recovery_meetings +layout.svelte`, data);
|
||||
}
|
||||
|
||||
let ae_acct = data[$slct.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
// *** Quickly pull out data from parent(s)
|
||||
untrack(() => {
|
||||
$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.
|
||||
|
||||
// *** Set initial variables
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
interface Props {
|
||||
/** @type {import('./$types').PageData} */
|
||||
data: any;
|
||||
@@ -10,7 +11,6 @@
|
||||
// *** Import Svelte specific
|
||||
import { page } from '$app/state';
|
||||
import { browser } from '$app/environment';
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
import { db_events } from '$lib/ae_events/db_events';
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
import Help_tech from '$lib/app_components/e_app_help_tech.svelte';
|
||||
|
||||
// *** Quickly pull out data from parent(s)
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = data[data.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
let log_lvl = $state(0);
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { untrack } from 'svelte';
|
||||
// import { browser } from '$app/environment';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
@@ -26,23 +27,29 @@
|
||||
}
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
// Initialize/Reset Entry Query defaults on layout load
|
||||
// $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;
|
||||
// Use effects for store initializations to prevent render-phase updates
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(`$slct.account_id = `, $slct.account_id);
|
||||
untrack(() => {
|
||||
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);
|
||||
|
||||
@@ -271,15 +278,12 @@
|
||||
class:opacity-0={yTop < 750}
|
||||
class:ae_btn_warning_filled={yTop > 1500}
|
||||
onclick={() => {
|
||||
log_lvl = 1;
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Scroll to top button clicked. yScroll: ${yScroll} scrollTop: ${scroll_container().scrollTop}`,
|
||||
scroll_container()
|
||||
);
|
||||
}
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Scroll to top button clicked. yScroll: ${yScroll} scrollTop: ${scroll_container().scrollTop}`,
|
||||
scroll_container()
|
||||
);
|
||||
}
|
||||
|
||||
console.log('Not Safari, using smooth scroll to top');
|
||||
document.getElementById('ae_main_content')?.scrollTo({
|
||||
@@ -341,15 +345,12 @@
|
||||
class:opacity-0={yTop < 750}
|
||||
class:ae_btn_warning_filled={yTop > 1500}
|
||||
onclick={() => {
|
||||
log_lvl = 1;
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Scroll to bottom button clicked. yScroll: ${yScroll} scrollTop: ${scroll_container().scrollTop}`,
|
||||
scroll_container()
|
||||
);
|
||||
}
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Scroll to bottom button clicked. yScroll: ${yScroll} scrollTop: ${scroll_container().scrollTop}`,
|
||||
scroll_container()
|
||||
);
|
||||
}
|
||||
|
||||
console.log('Not Safari, using smooth scroll to bottom');
|
||||
document.getElementById('ae_main_content')?.scrollTo({
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
|
||||
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(() => {
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
import AeCompModalJournalImport from '../ae_comp__modal_journal_import.svelte';
|
||||
|
||||
// Variables
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let ae_acct = data[data.account_id];
|
||||
let show_export_modal = $state(false);
|
||||
let show_import_modal = $state(false);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
// Variables
|
||||
// *** 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);
|
||||
|
||||
$effect(() => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
/**
|
||||
* ae_comp__journal_entry_obj_id_view.svelte
|
||||
* Reference Implementation for Journal Entry View/Edit
|
||||
@@ -8,7 +9,6 @@
|
||||
|
||||
// *** Import Svelte core
|
||||
import { goto } from '$app/navigation';
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
// *** Import secondary libraries
|
||||
import { marked } from 'marked';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
/**
|
||||
* ae_comp__journal_obj_id_edit.svelte
|
||||
* Standardized Journal-level configuration.
|
||||
@@ -41,7 +42,6 @@
|
||||
} from 'lucide-svelte';
|
||||
import { Modal } from 'flowbite-svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import { ae_loc, ae_api } from '$lib/stores/ae_stores';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
/**
|
||||
* ae_comp__modal_journal_config.svelte
|
||||
* Standardized Module-level settings for Journals.
|
||||
@@ -19,7 +20,6 @@
|
||||
Wrench
|
||||
} from 'lucide-svelte';
|
||||
import { Modal } from 'flowbite-svelte';
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import { ae_loc, ae_api } from '$lib/stores/ae_stores';
|
||||
|
||||
Reference in New Issue
Block a user