Mostly working before major fix for data shared.
This commit is contained in:
@@ -68,6 +68,8 @@ 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_sess.ds.submit_status = null;
|
||||
@@ -76,8 +78,11 @@ $ae_sess.ds.update_status = null;
|
||||
|
||||
let trigger: null|string = null;
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// 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 ($ae_ds_loc.loaded_on && $ae_ds_loc.chk_account_id == $ae_loc.account_id) {
|
||||
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}`);
|
||||
let loaded_on = new Date($ae_ds_loc.loaded_on);
|
||||
let now = new Date();
|
||||
let diff = now.getTime() - loaded_on.getTime();
|
||||
@@ -91,8 +96,8 @@ if ($ae_ds_loc.loaded_on && $ae_ds_loc.chk_account_id == $ae_loc.account_id) {
|
||||
trigger = 'load__ds__code';
|
||||
}, random_ms);
|
||||
}
|
||||
} else {
|
||||
console.log('No loaded_on date found and or the account_id check failed. Need to trigger reload.');
|
||||
} else if (browser) {
|
||||
console.log('ae_data_store No loaded_on date found and or the account_id check failed. Need to trigger reload.');
|
||||
trigger = 'load__ds__code';
|
||||
}
|
||||
|
||||
@@ -105,7 +110,7 @@ onMount(() => {
|
||||
console.log('Element: Data Store element_data_store.svelte');
|
||||
|
||||
// Wait for random number of milliseconds to avoid all data stores being reloaded at the same time.
|
||||
let random_ms = Math.floor(Math.random() * 500);
|
||||
let random_ms = Math.floor(Math.random() * 750);
|
||||
console.log(`Random number of milliseconds: ${random_ms}`);
|
||||
setTimeout(() => {
|
||||
trigger = 'load__ds__code';
|
||||
|
||||
Reference in New Issue
Block a user