Skip to content

Commit caed413

Browse files
author
Daniel Spitzer
committed
fix(app): Log with appId as soon as it has one
1 parent 3efa969 commit caed413

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ export function app() {
208208
function handleConnack({ data: message, source: sourceWindow }) {
209209
appId = message.target || '';
210210
token = message.token || '';
211+
debug = log('ts:io:sub:' + appId);
212+
213+
debug('CONNECTED %o', message);
211214

212215
const queueLength = flushQueue(message.token);
213216
if (queueLength) {
@@ -229,7 +232,6 @@ export function app() {
229232
*/
230233
const eventHandler = event => {
231234
const message = event.data;
232-
debug = log('ts:io:sub:' + appId);
233235
// Only accept messages from the hub in window.top.
234236
if (event.source !== window.top || !appMessageValid(message)) {
235237
return;
@@ -240,7 +242,7 @@ export function app() {
240242
}
241243

242244
// Call the matching handlers for the message topic.
243-
if (message.type !== 'PING') {
245+
if (!['PING', 'CONNACK'].includes(message.type)) {
244246
debug(
245247
'Received %s %s from %o - %O',
246248
message.type,
@@ -252,7 +254,6 @@ export function app() {
252254

253255
switch (message.type) {
254256
case 'CONNACK':
255-
debug('CONNECTED %o', message);
256257
handleConnack(event);
257258
if (message.source) {
258259
handleSpawn(event);

0 commit comments

Comments
 (0)