import { useMemo } from "react" ; import { GQLFEATURE_FLAG } from "coral-framework/schema" ; import { FEATURE_FLAG } from "coral-stream/__generated__/AllCommentsTabContainer_settings.graphql" ; interface Props { story : { isClosed : boolean ; settings : { live : { enabled : boolean ; } ; } ; } ; settings : { disableCommenting : { enabled : boolean ; } ; featureFlags ? : ReadonlyArray < FEATURE_FLAG > ; } ; } const useLive = ( { story , settings } ) => useMemo ( ( ) => { if ( ! story . settings . live . enabled || story . isClosed || settings . disableCommenting . enabled || settings . featureFlags ?. includes ( GQLFEATURE_FLAG . DISABLE_LIVE_UPDATES ) ) { return false ; } return true ; } , [ story . isClosed , settings . disableCommenting . enabled , story . settings . live . enabled , settings . featureFlags , ] ) ; export default useLive ;