File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ export const useStore = (store, selector) => {
5
5
let [ , force ] = useState ( { } )
6
6
useEffect ( ( ) => {
7
7
let cb = ( ) => unstable_batchedUpdates ( ( ) => force ( { } ) )
8
- return store . _run ? store . listen ( cb ) : store . watch ( selector , cb )
8
+ return store . _run || ! store . watch
9
+ ? store . listen ( cb )
10
+ : store . watch ( selector , cb )
9
11
} , [ selector , store ] )
10
12
return store . get ( selector )
11
13
}
Original file line number Diff line number Diff line change 1
- import { computed , createAtom , take } from 'dotto.x'
1
+ import { computed , createAtom , take , update } from 'dotto.x'
2
2
import { onChange } from 'dotto.x/lifecycle'
3
3
import { get } from 'dotto.x/utils/get'
4
4
@@ -15,7 +15,7 @@ export const validator = (store, rules) => {
15
15
if ( res ) reason = res
16
16
return res
17
17
} )
18
- errors . set ( { ...errors . get ( ) , [ path ] : reason } )
18
+ update ( errors , data => ( { ...data , [ path ] : reason } ) )
19
19
}
20
20
} )
21
21
return { errors, destroy, valid }
You can’t perform that action at this time.
0 commit comments