added sse2
This commit is contained in:
@@ -7,6 +7,7 @@ import { loadProductCategoryTabNames } from '@/utils/categoryTabs'
|
||||
import { getLastPrices, startLastPricePolling, stopLastPricePolling } from '@/utils/price'
|
||||
import {
|
||||
priceSocketConnected,
|
||||
priceStreamLifecycle,
|
||||
priceWssEnabled,
|
||||
shouldUsePricePolling,
|
||||
} from '@/utils/priceSocketState'
|
||||
@@ -127,14 +128,9 @@ function syncProductListPolling() {
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [priceWssEnabled.value, priceSocketConnected.value] as const,
|
||||
([wssEnabled, connected], prev) => {
|
||||
const prevConnected = prev?.[1]
|
||||
() => [priceWssEnabled.value, priceSocketConnected.value, priceStreamLifecycle.value] as const,
|
||||
() => {
|
||||
syncProductListPolling()
|
||||
|
||||
if (wssEnabled && prevConnected && !connected && initialized.value) {
|
||||
void refreshProductsPageData()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -158,7 +154,9 @@ export function onProductsPageProviderMounted() {
|
||||
providerMountCount += 1
|
||||
pricePollingMountCount += 1
|
||||
if (pricePollingMountCount === 1) {
|
||||
void getLastPrices()
|
||||
if (shouldUsePricePolling()) {
|
||||
void getLastPrices()
|
||||
}
|
||||
startLastPricePolling()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user