What causes this warning?
I'm wondering what causes this warning as it heavily pollutes my logs
this is the code listening to the event, only in the root component. send is a function to update my local store
This is the action firing the broadcasts:
const counter = useActor({
name: 'events',
key: ['chats'],
});
counter.useEvent('append', (event: ChatEvent) => {
send(event);
});
const counter = useActor({
name: 'events',
key: ['chats'],
});
counter.useEvent('append', (event: ChatEvent) => {
send(event);
});
async (c, event: ChatEvent) => {
if (event.type !== 'Chat/SendMessage') {
return;
}
c.state.events.push(event);
c.broadcast('append', event);
const store = createChatStore({});
const send = store.getState().send;
for (const event of c.state.events) {
send(event);
}
const { context: chats } = store.getState();
const result = streamText({
model: 'moonshotai/kimi-k2',
messages: convertToModelMessages(chats['1'].messages),
experimental_transform: smoothStream({
chunking: 'word',
}),
providerOptions: {
gateway: {
order: ['groq', 'cerebras'],
},
},
});
Stream.fromAsyncIterable(result.fullStream, () => {}).pipe(
Stream.tap(function (chunk) {
return Effect.Do.pipe(
Effect.bind('timestamp', () => Clock.currentTimeMillis),
Effect.tap(function ({ timestamp }) {
return Effect.sync(async function () {
if (chunk.type === 'start-step') {
const event: ChatEvent = {
type: 'Chat/StartStep',
id: crypto.randomUUID(),
chatId: '1',
timestamp,
};
c.state.events.push(event);
c.broadcast('append', event);
} else if (chunk.type === 'text-start') {
const event: ChatEvent = {
type: 'Chat/TextStart',
chatId: '1',
timestamp,
providerMetadata: chunk.providerMetadata,
};
c.state.events.push(event);
c.broadcast('append', event);
} else if (chunk.type === 'text-delta') {
const event: ChatEvent = {
type: 'Chat/TextDelta',
chatId: '1',
timestamp,
delta: chunk.text,
};
c.state.events.push(event);
c.broadcast('append', event);
} else if (chunk.type === 'finish-step') {
const event: ChatEvent = {
type: 'Chat/FinishStep',
chatId: '1',
timestamp,
};
c.state.events.push(event);
c.broadcast('append', event);
}
});
})
);
}),
Stream.runDrain,
Effect.runPromise
);
}
async (c, event: ChatEvent) => {
if (event.type !== 'Chat/SendMessage') {
return;
}
c.state.events.push(event);
c.broadcast('append', event);
const store = createChatStore({});
const send = store.getState().send;
for (const event of c.state.events) {
send(event);
}
const { context: chats } = store.getState();
const result = streamText({
model: 'moonshotai/kimi-k2',
messages: convertToModelMessages(chats['1'].messages),
experimental_transform: smoothStream({
chunking: 'word',
}),
providerOptions: {
gateway: {
order: ['groq', 'cerebras'],
},
},
});
Stream.fromAsyncIterable(result.fullStream, () => {}).pipe(
Stream.tap(function (chunk) {
return Effect.Do.pipe(
Effect.bind('timestamp', () => Clock.currentTimeMillis),
Effect.tap(function ({ timestamp }) {
return Effect.sync(async function () {
if (chunk.type === 'start-step') {
const event: ChatEvent = {
type: 'Chat/StartStep',
id: crypto.randomUUID(),
chatId: '1',
timestamp,
};
c.state.events.push(event);
c.broadcast('append', event);
} else if (chunk.type === 'text-start') {
const event: ChatEvent = {
type: 'Chat/TextStart',
chatId: '1',
timestamp,
providerMetadata: chunk.providerMetadata,
};
c.state.events.push(event);
c.broadcast('append', event);
} else if (chunk.type === 'text-delta') {
const event: ChatEvent = {
type: 'Chat/TextDelta',
chatId: '1',
timestamp,
delta: chunk.text,
};
c.state.events.push(event);
c.broadcast('append', event);
} else if (chunk.type === 'finish-step') {
const event: ChatEvent = {
type: 'Chat/FinishStep',
chatId: '1',
timestamp,
};
c.state.events.push(event);
c.broadcast('append', event);
}
});
})
);
}),
Stream.runDrain,
Effect.runPromise
);
}

1 Reply