@@ -36,6 +36,9 @@ pub fn Scroll() -> impl IntoView {
3636 UseFloatingOptions :: default ( ) . strategy ( strategy. into ( ) ) ,
3737 ) ;
3838
39+ let strategy_update = update. clone ( ) ;
40+ let node_update = update. clone ( ) ;
41+
3942 let UseScrollReturn {
4043 scroll_ref,
4144 indicator,
@@ -115,17 +118,24 @@ pub fn Scroll() -> impl IntoView {
115118 <For
116119 each=|| ALL_STRATEGIES
117120 key=|local_strategy| format!( "{:?}" , local_strategy)
118- children=move |local_strategy| view! {
119- <button
120- data-testid=move || format!( "Strategy{:?}" , local_strategy) . to_case( Case :: Kebab )
121- style: background-color=move || match strategy( ) == local_strategy {
122- true => "black" ,
123- false => ""
124- }
125- on: click=move |_| set_strategy( local_strategy)
126- >
127- { format!( "{:?}" , local_strategy) . to_case( Case :: Kebab ) }
128- </button>
121+ children=move |local_strategy| {
122+ let strategy_update = strategy_update. clone( ) ;
123+
124+ view! {
125+ <button
126+ data-testid=move || format!( "Strategy{:?}" , local_strategy) . to_case( Case :: Kebab )
127+ style: background-color=move || match strategy( ) == local_strategy {
128+ true => "black" ,
129+ false => ""
130+ }
131+ on: click=move |_| {
132+ set_strategy( local_strategy) ;
133+ strategy_update( ) ;
134+ }
135+ >
136+ { format!( "{:?}" , local_strategy) . to_case( Case :: Kebab ) }
137+ </button>
138+ }
129139 }
130140 />
131141 </div>
@@ -135,17 +145,24 @@ pub fn Scroll() -> impl IntoView {
135145 <For
136146 each=|| ALL_NODES
137147 key=|local_node| format!( "{:?}" , local_node)
138- children=move |local_node| view! {
139- <button
140- data-testid=move || format!( "scroll-{}" , format!( "{:?}" , local_node) . to_case( Case :: Camel ) )
141- style: background-color=move || match node( ) == local_node {
142- true => "black" ,
143- false => ""
144- }
145- on: click=move |_| set_node( local_node)
146- >
147- { format!( "{:?}" , local_node) . to_case( Case :: Camel ) }
148- </button>
148+ children=move |local_node| {
149+ let node_update = node_update. clone( ) ;
150+
151+ view! {
152+ <button
153+ data-testid=move || format!( "scroll-{}" , format!( "{:?}" , local_node) . to_case( Case :: Camel ) )
154+ style: background-color=move || match node( ) == local_node {
155+ true => "black" ,
156+ false => ""
157+ }
158+ on: click=move |_| {
159+ set_node( local_node) ;
160+ node_update( ) ;
161+ }
162+ >
163+ { format!( "{:?}" , local_node) . to_case( Case :: Camel ) }
164+ </button>
165+ }
149166 }
150167 />
151168 </div>
0 commit comments