From 4eeb7034e177ca8e90bca2d0a00720ce0039da30 Mon Sep 17 00:00:00 2001 From: Gary Coady Date: Sat, 14 Dec 2024 09:34:39 +0000 Subject: [PATCH 1/2] Implement IntoSplitSignal for Field. --- tachys/src/reactive_graph/bind.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tachys/src/reactive_graph/bind.rs b/tachys/src/reactive_graph/bind.rs index 0286f532df..dbf807de60 100644 --- a/tachys/src/reactive_graph/bind.rs +++ b/tachys/src/reactive_graph/bind.rs @@ -10,12 +10,13 @@ use crate::{ view::{Position, ToTemplate}, }; use reactive_graph::{ + owner::Storage, signal::{ReadSignal, RwSignal, WriteSignal}, traits::{Get, Update}, wrappers::read::Signal, }; #[cfg(feature = "reactive_stores")] -use reactive_stores::{KeyedSubfield, Subfield}; +use reactive_stores::{ArcField, Field, KeyedSubfield, Subfield}; use send_wrapper::SendWrapper; use wasm_bindgen::JsValue; @@ -358,6 +359,21 @@ where } } +#[cfg(feature = "reactive_stores")] +impl IntoSplitSignal for Field +where + Self: Get + Update + Clone, + S: Storage>, +{ + type Value = T; + type Read = Self; + type Write = Self; + + fn into_split_signal(self) -> (Self::Read, Self::Write) { + (self.clone(), self.clone()) + } +} + #[cfg(feature = "reactive_stores")] impl IntoSplitSignal for KeyedSubfield where From a681173cb956eb82968193c860862214645f2fb1 Mon Sep 17 00:00:00 2001 From: Gary Coady Date: Mon, 16 Dec 2024 15:37:34 +0100 Subject: [PATCH 2/2] Fix imports --- tachys/src/reactive_graph/bind.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tachys/src/reactive_graph/bind.rs b/tachys/src/reactive_graph/bind.rs index dbf807de60..e30658a582 100644 --- a/tachys/src/reactive_graph/bind.rs +++ b/tachys/src/reactive_graph/bind.rs @@ -9,8 +9,9 @@ use crate::{ renderer::{types::Element, RemoveEventHandler}, view::{Position, ToTemplate}, }; +#[cfg(feature = "reactive_stores")] +use reactive_graph::owner::Storage; use reactive_graph::{ - owner::Storage, signal::{ReadSignal, RwSignal, WriteSignal}, traits::{Get, Update}, wrappers::read::Signal,