import { computed , IComputedValue } from 'mobx' ; import { useMemo } from 'react' ; import type { ObjectPropertyInfo } from '@cloudbeaver/core-sdk' ; interface ICategoriesInfo { categories : string [ ] ; isUncategorizedExists : boolean ; } export function useObjectPropertyCategories ( properties ) { const categories = useMemo ( ( ) => computed ( ( ) => { const result = { categories : [ ] , isUncategorizedExists : false , } ; for ( const property of properties ) { const category = property . category ; if ( ! category ) { result . isUncategorizedExists = true ; continue ; } if ( ! result . categories . includes ( category ) ) { result . categories . push ( category ) ; } } return result ; } ) , [ properties ] ) ; return categories . get ( ) ; }