v1.0.100 useSSESubscription ignore ping
All checks were successful
Deploy / Publish (push) Successful in 19s

This commit is contained in:
Nastya 2025-05-13 17:01:24 +03:00
parent f812320698
commit 1a81799106
2 changed files with 8 additions and 4 deletions

@ -27,9 +27,13 @@ export function useSSESubscription<T>({ enabled = true, url, onNewData, onDiscon
eventSource.addEventListener("close", () => devlog(`EventSource closed with ${url}`));
eventSource.addEventListener("message", event => {
try {
console.log("EVENT")
console.log(event)
if (!JSON.stringify(event).includes('"event":"ping"') && !JSON.stringify(event).includes("'event':'ping'")) {
const newData = JSON.parse(event.data) as T;
devlog(`new SSE: ${marker}`, newData);
onNewDataRef.current([newData]);
}
} catch (error) {
devlog(`SSE parsing error: ${marker}`, event.data, error);
}

@ -1,6 +1,6 @@
{
"name": "@frontend/kitui",
"version": "1.0.98",
"version": "1.0.99",
"description": "test",
"main": "./dist/index.js",
"module": "./dist/index.js",