@@ -103,37 +103,6 @@ impl Actor {
103
103
) ;
104
104
} ) ) ;
105
105
106
- let text = Arc :: clone ( & actor. text_tracker ) ;
107
- // actor.loro.subscribe(
108
- // &ContainerID::new_root("text", ContainerType::Text),
109
- // Arc::new(move |event| {
110
- // if event.from_children {
111
- // return;
112
- // }
113
- // let mut text = text.lock().unwrap();
114
- // match &event.container.diff {
115
- // Diff::Text(delta) => {
116
- // let mut index = 0;
117
- // for item in delta.iter() {
118
- // match item {
119
- // DeltaItem::Retain { len, meta: _ } => {
120
- // index += len;
121
- // }
122
- // DeltaItem::Insert { value, meta: _ } => {
123
- // text.insert_str(index, value);
124
- // index += value.len();
125
- // }
126
- // DeltaItem::Delete { len, .. } => {
127
- // text.drain(index..index + *len);
128
- // }
129
- // }
130
- // }
131
- // }
132
- // _ => unreachable!(),
133
- // }
134
- // }),
135
- // );
136
-
137
106
let tree = Arc :: clone ( & actor. tree_tracker ) ;
138
107
actor. loro . subscribe (
139
108
& ContainerID :: new_root ( "tree" , ContainerType :: Tree ) ,
@@ -164,63 +133,6 @@ impl Actor {
164
133
} ) ,
165
134
) ;
166
135
167
- let map = Arc :: clone ( & actor. map_tracker ) ;
168
- actor. loro . subscribe (
169
- & ContainerID :: new_root ( "map" , ContainerType :: Map ) ,
170
- Arc :: new ( move |event| {
171
- if event. from_children {
172
- return ;
173
- }
174
- let mut map = map. lock ( ) . unwrap ( ) ;
175
- if let Diff :: NewMap ( map_diff) = & event. container . diff {
176
- for ( key, value) in map_diff. updated . iter ( ) {
177
- match & value. value {
178
- Some ( value) => {
179
- map. insert ( key. to_string ( ) , value. clone ( ) ) ;
180
- }
181
- None => {
182
- map. remove ( & key. to_string ( ) ) ;
183
- }
184
- }
185
- }
186
- } else {
187
- debug_dbg ! ( & event. container) ;
188
- unreachable ! ( )
189
- }
190
- } ) ,
191
- ) ;
192
-
193
- let list = Arc :: clone ( & actor. list_tracker ) ;
194
- actor. loro . subscribe (
195
- & ContainerID :: new_root ( "list" , ContainerType :: List ) ,
196
- Arc :: new ( move |event| {
197
- if event. from_children {
198
- return ;
199
- }
200
- let mut list = list. lock ( ) . unwrap ( ) ;
201
- if let Diff :: List ( delta) = & event. container . diff {
202
- let mut index = 0 ;
203
- for item in delta. iter ( ) {
204
- match item {
205
- DeltaItem :: Retain { len, meta : _ } => {
206
- index += len;
207
- }
208
- DeltaItem :: Insert { value, meta : _ } => {
209
- for v in value {
210
- list. insert ( index, v. clone ( ) ) ;
211
- index += 1 ;
212
- }
213
- }
214
- DeltaItem :: Delete { len, .. } => {
215
- list. drain ( index..index + * len) ;
216
- }
217
- }
218
- }
219
- } else {
220
- unreachable ! ( )
221
- }
222
- } ) ,
223
- ) ;
224
136
actor
225
137
. text_containers
226
138
. push ( actor. loro . txn ( ) . unwrap ( ) . get_text ( "text" ) ) ;
0 commit comments