Bläddra i källkod

Deep copy objects printed to debug console (#471)

If this is not being done, then modifications done to the objects later
on will be reflected in the object logged.
Danilo Bargen 7 år sedan
förälder
incheckning
3dc258da40
1 ändrade filer med 3 tillägg och 1 borttagningar
  1. 3 1
      src/services/webclient.ts

+ 3 - 1
src/services/webclient.ts

@@ -494,7 +494,9 @@ export class WebClientService {
                 }
 
                 if (this.config.MSG_DEBUGGING) {
-                    this.$log.debug('[Message] Incoming:', message.type, '/', message.subType, message);
+                    // Deep copy message to prevent issues with JS debugger
+                    const deepcopy = JSON.parse(JSON.stringify(message));
+                    this.$log.debug('[Message] Incoming:', message.type, '/', message.subType, deepcopy);
                 }
 
                 // Process data