From ef3e6cedbecc3b3595c68e1b8d4e264d68b82bd6 Mon Sep 17 00:00:00 2001 From: Erk Struwe Date: Fri, 24 Jul 2015 09:39:47 +0200 Subject: [PATCH] Bugfix https://github.com/balderdashy/sails/issues/2636 --- lib/hooks/pubsub/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/hooks/pubsub/index.js b/lib/hooks/pubsub/index.js index 2e5233d0c9..5e3ded68b3 100644 --- a/lib/hooks/pubsub/index.js +++ b/lib/hooks/pubsub/index.js @@ -119,6 +119,9 @@ module.exports = function(sails) { */ broadcast: function(roomName, eventName, data, socketToOmit) { + if (data.previous && _.isFunction(data.previous.toJSON)) { + data.previous = _.clone(data.previous.toJSON(), true); + } sails.sockets.broadcast(roomName, eventName, data, socketToOmit); },