From f5870ece399ef49272ebda853df75fca0c1cfcba Mon Sep 17 00:00:00 2001 From: Christian Alfoni Date: Tue, 1 Sep 2020 08:20:31 +0200 Subject: [PATCH] fix(overmind): revert the new async serialize and parse strategy --- .../src/BackendConnector.ts | 2 -- .../src/overmind/actions.ts | 2 -- .../src/overmind/operators.ts | 13 ------------- packages/node_modules/overmind/src/Devtools.ts | 8 ++------ 4 files changed, 2 insertions(+), 23 deletions(-) diff --git a/packages/node_modules/overmind-devtools-client/src/BackendConnector.ts b/packages/node_modules/overmind-devtools-client/src/BackendConnector.ts index dc25302c..ca760bc0 100644 --- a/packages/node_modules/overmind-devtools-client/src/BackendConnector.ts +++ b/packages/node_modules/overmind-devtools-client/src/BackendConnector.ts @@ -1,5 +1,3 @@ -import { parse } from 'non-blocking-json' - import { AppMessage } from './overmind/types' type Message = { diff --git a/packages/node_modules/overmind-devtools-client/src/overmind/actions.ts b/packages/node_modules/overmind-devtools-client/src/overmind/actions.ts index 527a0578..8d0d8b73 100644 --- a/packages/node_modules/overmind-devtools-client/src/overmind/actions.ts +++ b/packages/node_modules/overmind-devtools-client/src/overmind/actions.ts @@ -20,8 +20,6 @@ import { createApp, getActionId, isValidJson } from './utils' export const onMessage: Operator = pipe( o.ensureCurrentApp(), - o.stringifyMessage(), - o.filterStringified(), o.ensureApp(), o.addClientMessage(), o.getMessage(), diff --git a/packages/node_modules/overmind-devtools-client/src/overmind/operators.ts b/packages/node_modules/overmind-devtools-client/src/overmind/operators.ts index 3791b345..358133a4 100644 --- a/packages/node_modules/overmind-devtools-client/src/overmind/operators.ts +++ b/packages/node_modules/overmind-devtools-client/src/overmind/operators.ts @@ -1,4 +1,3 @@ -import { parse, Payload } from 'non-blocking-json' import { Operator, filter, fork, map, mutate } from 'overmind' import { @@ -106,18 +105,6 @@ export const addClientMessage: () => Operator = () => state.apps[message.appName].messages.unshift(message.message) }) -export const stringifyMessage: () => Operator = () => - map((_, message) => { - const result = parse(message.message as unknown as Payload) - - return result ? { - ...message, - message: result - } : undefined - }) - -export const filterStringified: () => Operator = () => - filter((_, message) => Boolean(message)) export const addComponent: () => Operator = () => mutate(({ state }, message) => { diff --git a/packages/node_modules/overmind/src/Devtools.ts b/packages/node_modules/overmind/src/Devtools.ts index c23d9ff7..528e4122 100644 --- a/packages/node_modules/overmind/src/Devtools.ts +++ b/packages/node_modules/overmind/src/Devtools.ts @@ -1,4 +1,3 @@ -import { stringify } from 'non-blocking-json' import { SERIALIZE } from './rehydrate' export type Message = { @@ -83,11 +82,8 @@ export class Devtools { const unsafeClassNames = this.unsafeClassNames const circularReferenceCache = this.circularReferenceCache - stringify( + this.sendMessage(JSON.stringify( message, - (payload) => { - this.sendMessage(payload) - }, function (_, value) { if (typeof value === 'function') { return '[Function]' @@ -140,7 +136,7 @@ export class Devtools { return value } - ) + )) circularReferenceCache.length = 0 }