Skip to content

Commit

Permalink
Change _.clone object spread
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Apr 25, 2018
1 parent 57f7d7c commit 63805b5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RocketChat.integrations.triggerHandler = new class RocketChatIntegrationHandler
}

if (data) {
history.data = _.clone(data);
history.data = { ...data };

if (data.user) {
history.data.user = _.omit(data.user, ['meta', '$loki', 'services']);
Expand Down

4 comments on commit 63805b5

@mrsimpson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that’s a nice one I didn’t know. Thanks!

@graywolf336
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sampaiodiego but does this actually clone the object? Because we needed it to clone the data so that the changes to the data stored on history.data don't reflect back to the data passed in..

@sampaiodiego
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it does a clone 😉

@graywolf336
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sampaiodiego I am going to have to disagree with you:
image

Please sign in to comment.