diff --git a/src/EventsPanel.tsx b/src/EventsPanel.tsx index 66e321c9..22e31e13 100644 --- a/src/EventsPanel.tsx +++ b/src/EventsPanel.tsx @@ -343,9 +343,13 @@ const newEventMachine = newEventModel.createMachine({ on: { '*': [ { - cond: (ctx) => { + cond: (_, e) => { try { - const eventObject = JSON.parse(ctx.eventString); + const eventObject = JSON.parse( + (e as ReturnType< + typeof newEventModel.events['EVENT.PAYLOAD'] + >).value, + ); return typeof eventObject.type === 'string'; } catch (e) { return false; diff --git a/src/simulationMachine.tsx b/src/simulationMachine.tsx index 4d699ce8..59722bba 100644 --- a/src/simulationMachine.tsx +++ b/src/simulationMachine.tsx @@ -303,7 +303,10 @@ export const simulationMachine = simModel.createMachine( (ctx, e) => { return { type: 'xstate.event', - event: e.event, + event: { + ...e.event, + origin: e.event.origin || ctx.currentSessionId, + }, sessionId: ctx.currentSessionId, }; },