From 02501fed012261b467fe386fb0d503e88df474a1 Mon Sep 17 00:00:00 2001 From: Thibault Maekelbergh Date: Mon, 10 Dec 2018 13:30:05 +0100 Subject: [PATCH] fix(subscriptions): Allows you to subscribe to * and see the entire store --- src/reactotron-core-server.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/reactotron-core-server.ts b/src/reactotron-core-server.ts index e50e6596..2050fae0 100644 --- a/src/reactotron-core-server.ts +++ b/src/reactotron-core-server.ts @@ -1,4 +1,4 @@ -import { merge, find, propEq, without, contains, forEach, pluck, reject } from "ramda" +import { merge, find, propEq, without, contains, forEach, pluck, reject, equals } from "ramda" import { Server as WebSocketServer, OPEN } from "ws" import * as mitt from "mitt" import validate from "./validation" @@ -292,9 +292,16 @@ export default class Server { if (contains(path, this.subscriptions)) { return } + + // monitor the complete state when * (star selector) is entered + if (equals(path, '*')) { + this.subscriptions.push('') + } else { + this.subscriptions.push(path) + } + // subscribe - this.subscriptions.push(path) this.stateValuesSendSubscriptions() }