fix issues with loading time
This commit is contained in:
parent
98759cbdef
commit
bc758db681
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
export let form;
|
export let form;
|
||||||
|
let isLoaded = false;
|
||||||
|
|
||||||
$strategyId = data?.getStrategyId;
|
$strategyId = data?.getStrategyId;
|
||||||
let ruleOfList = data?.getStrategy?.rules ?? [];
|
let ruleOfList = data?.getStrategy?.rules ?? [];
|
||||||
@ -265,6 +266,7 @@ async function handleRule(newRule) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateStockScreenerData() {
|
async function updateStockScreenerData() {
|
||||||
|
isLoaded = false;
|
||||||
try {
|
try {
|
||||||
const newData = await getStockScreenerData(ruleOfList);
|
const newData = await getStockScreenerData(ruleOfList);
|
||||||
stockScreenerData = newData?.filter(item =>
|
stockScreenerData = newData?.filter(item =>
|
||||||
@ -284,6 +286,7 @@ async function updateStockScreenerData() {
|
|||||||
style: 'border-radius: 200px; background: #333; color: #fff;'
|
style: 'border-radius: 200px; background: #333; color: #fff;'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleResetAll() {
|
async function handleResetAll() {
|
||||||
@ -394,6 +397,7 @@ async function handleSave(printToast) {
|
|||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (ruleOfList) {
|
if (ruleOfList) {
|
||||||
|
isLoaded = false;
|
||||||
const ruleToUpdate = ruleOfList?.find(rule => rule.name === ruleName);
|
const ruleToUpdate = ruleOfList?.find(rule => rule.name === ruleName);
|
||||||
if (ruleToUpdate) {
|
if (ruleToUpdate) {
|
||||||
ruleToUpdate.value = valueMappings[ruleToUpdate.name];
|
ruleToUpdate.value = valueMappings[ruleToUpdate.name];
|
||||||
@ -545,8 +549,13 @@ $: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: displayResults = filteredData?.slice(0, 50);
|
$: {
|
||||||
console.log(displayResults)
|
if(displayResults && typeof window !== 'undefined' && isLoaded === false) {
|
||||||
|
displayResults = filteredData?.slice(0, 50);
|
||||||
|
isLoaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$: isSaved = !ruleOfList;
|
$: isSaved = !ruleOfList;
|
||||||
|
|
||||||
$: charNumber = $screenWidth < 640 ? 20 : 40;
|
$: charNumber = $screenWidth < 640 ? 20 : 40;
|
||||||
@ -985,7 +994,7 @@ async function popularStrategy(state: string) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--Start Matching Preview-->
|
<!--Start Matching Preview-->
|
||||||
|
{#if isLoaded}
|
||||||
{#if displayResults?.length !== 0}
|
{#if displayResults?.length !== 0}
|
||||||
|
|
||||||
{#if displayTableTab === 'general'}
|
{#if displayTableTab === 'general'}
|
||||||
@ -1116,7 +1125,7 @@ async function popularStrategy(state: string) {
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex justify-center items-center h-80">
|
<div class="flex justify-center items-center h-80">
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user