fix kashkool

This commit is contained in:
2026-06-29 22:43:28 +03:30
parent be17631109
commit 8b855e5ee4
150 changed files with 11974 additions and 4445 deletions
+10
View File
@@ -3,10 +3,15 @@ import type { Product } from '@/models/products'
type ProductListHandler = (products: Product[]) => void
const handlers = new Set<ProductListHandler>()
let lastProductsList: Product[] | null = null
export function subscribeProductListStream(handler: ProductListHandler) {
handlers.add(handler)
if (lastProductsList?.length) {
handler(lastProductsList)
}
return () => {
handlers.delete(handler)
}
@@ -17,5 +22,10 @@ export function applyProductsListFromStream(products: Product[]) {
return
}
lastProductsList = products
handlers.forEach((handler) => handler(products))
}
export function getLastStreamProductsList(): Product[] | null {
return lastProductsList
}