bugfixing websocket

This commit is contained in:
MuslemRahimi 2024-12-10 16:39:56 +01:00
parent e166bb7d19
commit 1af24ec844
2 changed files with 10 additions and 9 deletions

View File

@ -409,12 +409,12 @@
$: stockList = [...stockList];
$: if ($isOpen) {
websocketRealtimeData();
console.log("WebSocket restarted");
}
onMount(async () => {
// Initialize the download worker if not already done
if ($isOpen) {
await websocketRealtimeData();
console.log("WebSocket restarted due to watchlist changes");
}
try {
const savedRules = localStorage?.getItem(pagePathName);

View File

@ -580,6 +580,11 @@
}
}
$: if ($isOpen) {
websocketRealtimeData();
console.log("WebSocket restarted");
}
onMount(async () => {
try {
const savedRules = localStorage?.getItem("watchlist-ruleOfList");
@ -648,10 +653,6 @@
console.log(e);
}
if ($isOpen) {
await websocketRealtimeData();
}
window.addEventListener("scroll", handleScroll);
return () => {
window.removeEventListener("scroll", handleScroll);