3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @connectv/core" ,
3
- "version" : " 0.2.2 " ,
3
+ "version" : " 0.2.3 " ,
4
4
"description" : " agent-based reactive programming library for typescript/javascript" ,
5
5
"keywords" : [
6
6
" connective" ,
Original file line number Diff line number Diff line change @@ -54,8 +54,6 @@ export class KeyedDeep extends SimpleDeep {
54
54
let initialized = false ;
55
55
let _this = this ;
56
56
57
- this . output ; // --> wire output before hand
58
-
59
57
let accessor : DeepAccessor = {
60
58
initial : ( _this . _keyMap [ key ] || { item : undefined } ) . item
61
59
|| ( Object . values ( this . value ) || [ ] ) . find ( ( i : any ) => this . keyfunc ( i ) == key ) ,
@@ -154,6 +152,8 @@ export class KeyedDeep extends SimpleDeep {
154
152
155
153
protected createOutput ( label : string ) : PinLike {
156
154
if ( label === 'changes' ) {
155
+ this . output ; // --> wire output before hand
156
+
157
157
return this . state . to ( map ( ( value : any , done : ( _ : ChangeMap ) => void ) => {
158
158
const result = diff ( value , this . _keyMap , this . keyfunc ) ;
159
159
this . _keyMap = result . newKeyMap ;
Original file line number Diff line number Diff line change @@ -309,5 +309,11 @@ describe('KeyedDeep', () => {
309
309
310
310
s . value = [ { id : 'jack' , age : 24 } ] . concat ( s . value ) ;
311
311
} ) ;
312
+
313
+ it ( 'should be possible to first subscribe on `.changes` and then on the state' , ( ) => {
314
+ let s = new KeyedDeep ( new State ( [ ] ) , _ => _ . id ) ;
315
+ s . changes . subscribe ( ) ;
316
+ s . subscribe ( ) ;
317
+ } ) ;
312
318
} ) ;
313
319
} ) ;
0 commit comments