chore: sync project updates
This commit is contained in:
@@ -282,21 +282,28 @@ export function notifyPriceLastFetchFailed() {
|
||||
void maybeShowNetworkAlert()
|
||||
}
|
||||
|
||||
function onTvBoard() {
|
||||
if (typeof window === 'undefined') return false
|
||||
const path = window.location.pathname.replace(/\/+$/, '') || '/'
|
||||
return path === '/tv' || path.endsWith('/tv') || path === '/monitor' || path.endsWith('/monitor')
|
||||
}
|
||||
|
||||
async function runFallbackPoll() {
|
||||
if (!priceWssEnabled.value || priceSocketConnected.value) {
|
||||
if (onTvBoard() || tvStreamKey || !priceWssEnabled.value || priceSocketConnected.value) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const { getLastPrices, hasRecentPriceFromSource } = await import('@/utils/price')
|
||||
const { refreshProductsPageData } = await import(
|
||||
'@/views/base/products/composables/useProductsPageData'
|
||||
)
|
||||
const jobs: Promise<unknown>[] = [getLastPrices()]
|
||||
if (!tvStreamKey) {
|
||||
const { refreshProductsPageData } = await import(
|
||||
'@/views/base/products/composables/useProductsPageData'
|
||||
)
|
||||
jobs.push(refreshProductsPageData())
|
||||
}
|
||||
|
||||
const [priceResult] = await Promise.allSettled([
|
||||
getLastPrices(),
|
||||
refreshProductsPageData(),
|
||||
])
|
||||
const [priceResult] = await Promise.allSettled(jobs)
|
||||
|
||||
const priceOk =
|
||||
priceResult.status === 'fulfilled'
|
||||
@@ -743,6 +750,10 @@ function unbindBrowserNetworkListeners() {
|
||||
window.removeEventListener('offline', onBrowserOffline)
|
||||
}
|
||||
|
||||
export function isTvStreamActive() {
|
||||
return Boolean(tvStreamKey)
|
||||
}
|
||||
|
||||
export function startTvPriceStream(
|
||||
settingGetter: (key: string) => unknown,
|
||||
key: string,
|
||||
|
||||
Reference in New Issue
Block a user