messense/leptos_sse

Creating Signal later in client code breaks stream

smessmer opened this issue · 1 comments

create_sse_signal seems to work correctly when called during server side rendering and then hydrated on the client, but if it gets called later in the client stage, for example when the client router switches pages and the new page component calls create_sse_signal, then the signal just returns None and forgets that the sse channel is already established and the server already sent a value previously. Any further updates sent from the server do trigger a signal update, but if it's an unchanged value sending an empty patch, then it just changes from None to None. If the server sends a changed value, then applying the patch fails on the client with an error.

I think the issue might be that any events that were already sent on the sse channel before the signal is created are ignored.