Skip to content

Commit

Permalink
feat: Fix borrow checker errors in freenet_api synchronizer
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Dec 23, 2024
1 parent 8c10c17 commit f934021
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ui/src/components/app/freenet_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl FreenetApiSynchronizer {
let subscribed_contracts = HashSet::new();
let (request_sender, _request_receiver) = futures::channel::mpsc::unbounded();

let sender = FreenetApiSender { request_sender: request_sender.clone() };
let _sender = FreenetApiSender { request_sender: request_sender.clone() };

// Start the sync coroutine
use_coroutine(move |mut rx| {
Expand Down Expand Up @@ -111,8 +111,9 @@ impl FreenetApiSynchronizer {
let mut rooms = use_context::<Signal<Rooms>>();
let mut rooms = rooms.write();
if let Some(room_data) = rooms.map.values_mut().find(|r| r.contract_key == key) {
let current_state = room_data.room_state.clone();
if let Err(e) = room_data.room_state.merge(
&room_data.room_state,
&current_state,
&room_data.parameters(),
&room_state
) {
Expand All @@ -129,8 +130,9 @@ impl FreenetApiSynchronizer {
let key_bytes: [u8; 32] = key.id().as_bytes().try_into().expect("Invalid key length");
if let Some(room_data) = rooms.map.get_mut(&VerifyingKey::from_bytes(&key_bytes).expect("Invalid key bytes")) {
if let Ok(delta) = ciborium::from_reader(update.unwrap_delta().as_ref()) {
let current_state = room_data.room_state.clone();
if let Err(e) = room_data.room_state.apply_delta(
&room_data.room_state,
&current_state,
&room_data.parameters(),
&Some(delta)
) {
Expand Down

0 comments on commit f934021

Please sign in to comment.