Properly unwrap StateEvent state before calling handler

This commit is contained in:
Garrett Mills 2022-08-09 22:27:19 -05:00
parent b8cf8499d2
commit 8a153e3807
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@extollo/lib",
"version": "0.13.4",
"version": "0.13.5",
"description": "The framework library that lifts up your code.",
"main": "lib/index.js",
"types": "lib/index.d.ts",

View File

@ -93,7 +93,9 @@ export class SocketRouteBuilder {
*/
async build(request: Request, ws: WebSocketBus): Promise<void> {
await this.handlers.promiseMap(handler => {
ws.subscribe(handler.eventClass, handler.handler.apply(request))
ws.subscribe(handler.eventClass, (event: StateEvent<JSONState>) => {
return handler.handler.apply(request)(event.getState())
})
})
if ( this.connectionCallback ) {