I am not really sure... I just want it to load correctly.

This commit is contained in:
Scott Idem
2024-03-26 20:15:24 -04:00
parent a30690ea2a
commit a8a2131361
3 changed files with 64 additions and 19 deletions

View File

@@ -69,7 +69,7 @@ console.log(`ae_e_data_store cached: ${ds_code} = `, $ae_ds_loc);
if (!$ae_ds_loc.id) {
ds_loading_status = '-- loading --';
} else {
ae_ds_loc.set($ae_ds_loc);
// ae_ds_loc.set($ae_ds_loc);
}
$ae_sess.ds.submit_status = null;
@@ -80,6 +80,12 @@ let trigger: null|string = null;
import { browser } from '$app/environment';
if (browser) {
console.log('ae_ Browser detected.');
} else {
console.log('ae_ Browser not detected.');
}
// This is a quick check to make sure the data store is not stale. If it is, then we need to trigger a reload.
if (browser && $ae_ds_loc.loaded_on && $ae_ds_loc.chk_account_id == $ae_loc.account_id) {
console.log(`ae_data_store ${ds_code} loaded_on: ${$ae_ds_loc.loaded_on}`);
@@ -108,9 +114,10 @@ if (!$ae_ds_loc.account_id === null || $ae_loc.account_id == $ae_loc.account_id)
onMount(() => {
console.log('Element: Data Store element_data_store.svelte');
// console.log('ae_ MOUNTED Browser detected.');
// Wait for random number of milliseconds to avoid all data stores being reloaded at the same time.
let random_ms = Math.floor(Math.random() * 750);
let random_ms = Math.floor(Math.random() * 1500);
console.log(`Random number of milliseconds: ${random_ms}`);
setTimeout(() => {
trigger = 'load__ds__code';