File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
frameworks/keyed/sycamore Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ crate-type = ["cdylib"]
10
10
[dependencies ]
11
11
getrandom = {version = " 0.2" , features = [" js" ]}
12
12
rand = {version = " 0.8" , features = [" small_rng" ]}
13
- sycamore = " 0.5"
13
+ sycamore = " 0.5.1 "
14
14
wasm-bindgen = " 0.2.74"
15
15
web-sys = {version = " 0.3.51" , features = [" Window" , " Document" ]}
16
16
Original file line number Diff line number Diff line change @@ -77,16 +77,20 @@ fn build_data(count: usize) -> Vec<RowData> {
77
77
data. reserve_exact ( count) ;
78
78
79
79
for _i in 0 ..count {
80
- let label = Signal :: new ( format ! (
81
- "{} {} {}" ,
82
- ADJECTIVES . choose( & mut thread_rng) . unwrap( ) ,
83
- COLOURS . choose( & mut thread_rng) . unwrap( ) ,
84
- NOUNS . choose( & mut thread_rng) . unwrap( )
85
- ) ) ;
80
+ let adjective = ADJECTIVES . choose ( & mut thread_rng) . unwrap ( ) ;
81
+ let colour = COLOURS . choose ( & mut thread_rng) . unwrap ( ) ;
82
+ let noun = NOUNS . choose ( & mut thread_rng) . unwrap ( ) ;
83
+ let capacity = adjective. len ( ) + colour. len ( ) + noun. len ( ) + 2 ;
84
+ let mut label = String :: with_capacity ( capacity) ;
85
+ label. push_str ( adjective) ;
86
+ label. push ( ' ' ) ;
87
+ label. push_str ( colour) ;
88
+ label. push ( ' ' ) ;
89
+ label. push_str ( noun) ;
86
90
87
91
data. push ( RowData {
88
92
id : ID_COUNTER . load ( Ordering :: Relaxed ) ,
89
- label,
93
+ label : Signal :: new ( label ) ,
90
94
} ) ;
91
95
92
96
ID_COUNTER . store ( ID_COUNTER . load ( Ordering :: Relaxed ) + 1 , Ordering :: Relaxed ) ;
You can’t perform that action at this time.
0 commit comments