import { EMPTY_VALUE } from "../internal/empty-value" ; import { noop , Observable } from "rxjs" ; import { useSubscription } from "../Subscribe" ; import shareLatest from "../internal/share-latest" ; import { useObservable } from "../internal/useObservable" ; param observable remarks export default function connectObservable < T > ( observable , defaultValue ) { const sharedObservable$ = shareLatest < T > ( observable , defaultValue , false ) ; const useSub = defaultValue === EMPTY_VALUE ? useSubscription : noop ; const useStaticObservable = ( ) => useObservable ( sharedObservable$ , useSub ( ) as any ) ; return [ useStaticObservable , sharedObservable$ ] as const ; }