Skip to content

Commit 4c665ae

Browse files
kalvinnchaunpub122y0pqkertljmedu303rl0aqrj3w8pvu43t6jxm6875lzg6f2pwqegc3xcnpub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7
authored
fix(desktop): serialize tray channel actions for frontend (block#4762)
## Summary - serialize native `openChannel` tray actions with the camelCase field names consumed by the TypeScript frontend - prevent a valid tray channel ID from becoming `/channels/undefined` - add a Rust serialization contract test covering the complete frontend payload shape ### Root cause `TrayAction` renamed the enum variant to `openChannel`, but its struct fields still serialized as `channel_id` and `community_generation`. The frontend reads `action.channelId`, so tray navigation called `goChannel(undefined)`. ### Testing - manually verified the corrected runtime payload and tray navigation before removing temporary logging - `just desktop-ci` - pre-push hooks (desktop checks/tests, Tauri checks, and Rust tests) --------- Signed-off-by: Kalvin Chau <[email protected]> Signed-off-by: npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7 <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@buzz.block.builderlab.xyz> Co-authored-by: npub122y0pqkertljmedu303rl0aqrj3w8pvu43t6jxm6875lzg6f2pwqegc3xc <5288f082d91aff2de5bc8be23fbfa01ca2e3859cac57a91b7a3fa9f12349505c@buzz.block.builderlab.xyz> Co-authored-by: npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7 <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@buzz.block.builderlab.xyz>
1 parent b948c54 commit 4c665ae

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎desktop/src-tauri/src/tray_menu.rs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ struct TrayMenuState<R: Runtime> {
213213
pub enum TrayAction {
214214
NewChannel,
215215
OpenChannel {
216+
#[serde(rename = "channelId")]
216217
channel_id: String,
218+
#[serde(rename = "communityGeneration")]
217219
community_generation: u64,
218220
},
219221
}
@@ -614,6 +616,23 @@ pub fn update_tray_agent_activity<R: Runtime>(
614616
mod tests {
615617
use super::{requeue_actions, TrayAction, TrayActionQueue};
616618

619+
#[test]
620+
fn open_channel_action_serializes_with_frontend_field_names() {
621+
let action = TrayAction::OpenChannel {
622+
channel_id: "channel-123".into(),
623+
community_generation: 7,
624+
};
625+
626+
assert_eq!(
627+
serde_json::to_value(action).expect("tray action should serialize"),
628+
serde_json::json!({
629+
"kind": "openChannel",
630+
"channelId": "channel-123",
631+
"communityGeneration": 7,
632+
})
633+
);
634+
}
635+
617636
#[test]
618637
fn stale_channel_actions_are_not_requeued_after_community_change() {
619638
let mut queue = TrayActionQueue {

0 commit comments

Comments
 (0)