File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
src/js/packages/@reactpy/client/src Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export class ReactPyClient
6969 url : this . urls . componentUrl ,
7070 readyPromise : this . ready ,
7171 ...props . reconnectOptions ,
72- onMessage : ( event ) => this . handleIncoming ( JSON . parse ( event . data ) ) ,
72+ onMessage : async ( { data } ) => this . handleIncoming ( JSON . parse ( data ) ) ,
7373 } ) ;
7474 }
7575
Original file line number Diff line number Diff line change 11import type { ReactPyClientInterface } from "./types" ;
2- import serializeEvent from "event-to-object" ;
2+ import eventToObject from "event-to-object" ;
33import type {
44 ReactPyVdom ,
55 ReactPyVdomImportSource ,
@@ -212,7 +212,13 @@ function createEventHandler(
212212 if ( stopPropagation ) {
213213 event . stopPropagation ( ) ;
214214 }
215- return serializeEvent ( event ) ;
215+
216+ // Convert JavaScript objects to plain JSON, if needed
217+ if ( typeof event === "object" ) {
218+ return eventToObject ( event ) ;
219+ } else {
220+ return event ;
221+ }
216222 } ) ;
217223 client . sendMessage ( { type : "layout-event" , data, target } ) ;
218224 } ;
You can’t perform that action at this time.
0 commit comments