File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
packages/core/src/internal Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -34,24 +34,18 @@ export const useObservable = <O>(
3434 } , onError )
3535 if ( err !== EMPTY_VALUE ) return
3636
37- const set = ( value : O | ( ( ) => O ) ) => {
37+ const set = ( value : O ) => {
3838 if ( ! Object . is ( prevStateRef . current , value ) ) {
39- prevStateRef . current = value
40- if ( typeof value === "function" ) {
41- setState ( ( ) => [ ( value as any ) ( ) , source$ ] )
42- } else {
43- setState ( [ value , source$ ] )
44- }
39+ setState ( [ ( prevStateRef . current = value ) , source$ ] )
4540 }
4641 }
4742
48- if ( syncVal === EMPTY_VALUE ) {
49- set ( defaultValue )
50- }
43+ if ( syncVal === EMPTY_VALUE ) set ( defaultValue )
5144
5245 const t = subscription
5346 subscription = source$ . subscribe ( ( value : O | typeof SUSPENSE ) => {
54- set ( value === SUSPENSE ? gV : value )
47+ if ( value !== SUSPENSE ) set ( value )
48+ else setState ( gV as any )
5549 } , onError )
5650 t . unsubscribe ( )
5751
You can’t perform that action at this time.
0 commit comments