Skip to content

Commit

Permalink
merge: #2985
Browse files Browse the repository at this point in the history
2985: Avoid re-propagating siblings when a new children is connected to a frame r=paulocsanz a=paulocsanz



Co-authored-by: Paulo Cabral <[email protected]>
  • Loading branch information
si-bors-ng[bot] and paulocsanz authored Nov 29, 2023
2 parents 4033f6d + fa8f4b7 commit eea2e8d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use dal::job::definition::DependentValuesUpdate;
use dal::socket::{SocketEdgeKind, SocketKind};
use dal::{
node::NodeId, AttributeReadContext, AttributeValue, ChangeSet, Component, Connection,
DalContext, Edge, EdgeError, ExternalProvider, InternalProvider, InternalProviderId, Node,
PropId, StandardModel, Visibility, WsEvent,
DalContext, Edge, EdgeError, ExternalProvider, InternalProvider, Node, StandardModel,
Visibility, WsEvent,
};
use dal::{ComponentType, Socket};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -183,24 +183,33 @@ pub async fn connect_component_sockets_to_frame(
)
.await?;

let attribute_read_context = AttributeReadContext {
prop_id: Some(PropId::NONE),
internal_provider_id: Some(InternalProviderId::NONE),
external_provider_id: Some(*parent_provider.id()),
component_id: Some(*parent_component.id()),
};
let child_socket_internal_provider =
InternalProvider::find_explicit_for_socket(ctx, *child_socket.id())
.await?
.ok_or(DiagramError::InternalProviderNotFoundForSocket(
*child_socket.id(),
))?;

let attribute_value =
AttributeValue::find_for_context(ctx, attribute_read_context)
let child_attribute_value_context = AttributeReadContext {
internal_provider_id: Some(*child_socket_internal_provider.id()),
component_id: Some(*child_component.id()),
..Default::default()
};
let mut child_attribute_value =
AttributeValue::find_for_context(ctx, child_attribute_value_context)
.await?
.ok_or(DiagramError::AttributeValueNotFoundForContext(
attribute_read_context,
child_attribute_value_context,
))?;

child_attribute_value
.update_from_prototype_function(ctx)
.await?;

ctx.enqueue_job(DependentValuesUpdate::new(
ctx.access_builder(),
*ctx.visibility(),
vec![*attribute_value.id()],
vec![*child_attribute_value.id()],
))
.await?;
}
Expand Down
7 changes: 4 additions & 3 deletions lib/sdf-server/tests/service_tests/crdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use sdf_server::server::service::ws::crdt::{crdt_handle, BroadcastGroups, CrdtEr
use si_data_nats::{NatsClient, NatsConfig};
use std::{collections::HashMap, pin::Pin, sync::Arc, task::Context, task::Poll, time::Duration};
use tokio::{
sync::broadcast, sync::Mutex, sync::Notify, sync::RwLock, task, task::JoinHandle,
time::timeout,
sync::broadcast, sync::Mutex, sync::Notify, sync::RwLock, task, task::JoinHandle, time::timeout,
};
use y_sync::{awareness::Awareness, net::BroadcastGroup, net::Connection};
use yrs::{updates::encoder::Encode, Doc, GetString, Text, Transact, UpdateSubscription};
Expand All @@ -29,7 +28,9 @@ struct Client {

impl Drop for Client {
fn drop(&mut self) {
self.shutdown_broadcast_tx.send(()).expect("unable to drop client");
self.shutdown_broadcast_tx
.send(())
.expect("unable to drop client");
}
}

Expand Down

0 comments on commit eea2e8d

Please sign in to comment.