@xstate/store@4.3.0-alpha.2
Pre-release
Pre-release
Patch Changes
-
0f0d6e2: Fixed
fromStoreactor logic so that emitted events and enqueued effects run again. Previously,enq.emit(...)andenq.effect(...)inside a transition were silently dropped.const storeLogic = fromStore({ context: (count: number) => ({ count }), schemas: { emitted: { increased: z.object({ upBy: z.number() }) } }, on: { inc: (ctx, ev: { by: number }, enq) => { enq.emit.increased({ upBy: ev.by }); // now emitted return { ...ctx, count: ctx.count + ev.by }; } } }); const actor = createActor(storeLogic, { input: 42 }); actor.on('increased', (e) => console.log(e.upBy)); actor.start(); actor.send({ type: 'inc', by: 8 }); // logs: 8