From 3752c4d14c6d1b87122e9300e5b09d462c263958 Mon Sep 17 00:00:00 2001 From: Joel Lappalainen Date: Wed, 19 Jun 2019 21:11:43 +0300 Subject: [PATCH] Don't unsubscribe unless there are existing topics --- app/util/mqttClient.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/util/mqttClient.js b/app/util/mqttClient.js index ae7a8aad95..aa53545533 100644 --- a/app/util/mqttClient.js +++ b/app/util/mqttClient.js @@ -79,7 +79,9 @@ export function parseMessage(topic, message, agency) { export function changeTopics(settings, actionContext) { const { client, oldTopics } = settings; - client.unsubscribe(oldTopics); + if (Array.isArray(oldTopics) && oldTopics.length > 0) { + client.unsubscribe(oldTopics); + } // remove existing vehicles/topics actionContext.dispatch('RealTimeClientReset'); const topics = settings.options.map(option => getTopic(option, settings));