But when I send different enum values through the same stream, I get a panic from here with the error PatchError.
My assumption is, that this error happens if json_patch tries to patch totally unrelated data. Can we maybe handle the error case and return the new data instead of patching the old?
EDIT: My assumption seems to be true, if I wrap my enum in a struct, it works.
EDIT2: After some investigation, it seems as if the patch fails, because the value of doc is still SseSignal::Nop (the default value) but the patch that should be applied is:
Hey, an my app I want to use one SSE endpoint to send different signals to my GUI. I use a serializable enum as event-payload.
But when I send different enum values through the same stream, I get a panic from here with the error
PatchError
.My assumption is, that this error happens if
json_patch
tries to patch totally unrelated data. Can we maybe handle the error case and return the new data instead of patching the old?EDIT: My assumption seems to be true, if I wrap my enum in a struct, it works.
EDIT2: After some investigation, it seems as if the patch fails, because the value of
doc
is stillSseSignal::Nop
(the default value) but the patch that should be applied is:So it seems to be a synchronisation error between the two signals.