Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Conversation.cloneMessage throws away Symbol and Date objects #439

Closed
drhayes opened this issue Oct 12, 2016 · 0 comments
Closed

Conversation.cloneMessage throws away Symbol and Date objects #439

drhayes opened this issue Oct 12, 2016 · 0 comments

Comments

@drhayes
Copy link
Contributor

drhayes commented Oct 12, 2016

In working with the botkit I was trying to pass some custom middleware some Symbols on the message object. By the time the middleware gets them, the Symbols have all been nulled out.

Turns out that's because the cloneMessage method on Conversation uses JSON.parse and JSON.stringify to deep clone the message object. This method is great and really fast, except it discards values that aren't JSON-compatible, like Dates and Symbols and Functions. Not cool, man, not cool.

@drhayes drhayes changed the title Conversation.cloneMessage throws away Symbol and Date objects Conversation.cloneMessage throws away Symbol and Date objects Oct 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants