-
Notifications
You must be signed in to change notification settings - Fork 267
Conversation
…ute to use internally tagged format for enums
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, that was easier than I imagined 😅 I added custom serialization to Signal at first because I didn't know how deep I'd have to go with derive(Serialize)
for Action
but it turned out not too bad.
Kind of on a related note, what do you think of #1364? Now that Internal
signals are visible externally, maybe this PR is a good time to rename it to something other than Internal
, like Trace
?
that rename sounds interesting @maackle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Yeah, was looking into this as well when wrapping up @maackle PR and started adding those Serialize
derivations. I stopped when I though I had to make every action and their arguments serializable as well, but seems that is not needed if you use the adjacently tagged representation?
@@ -88,7 +88,8 @@ impl Hash for ActionWrapper { | |||
} | |||
|
|||
/// All Actions for the Holochain Instance Store, according to Redux pattern. | |||
#[derive(Clone, PartialEq, Debug)] | |||
#[derive(Clone, PartialEq, Debug, Serialize)] | |||
#[serde(tag = "action_type", content = "data")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha!
👏 👏 👏
Added #1378 as a followup |
PR summary
This changes the format of the JSON formatted signal being sent over the websocket. Prior to this the signals were debug formatted Rust which is difficult to handle in Javascript. This changes them to fully formed JSON.
This required implementing Serialize on all structs that can compose an Action and also adding the 'serde_support' feature to snowflake.
Before:
After:
changelog
Please check one of the following, relating to the CHANGELOG
- summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)