import { useModules } from 'hooks/useModules'
import { useState, useEffect } from 'react'

export function useHasModulesOnInit() {
  const [hasModules, setHasModules] = useState<boolean | undefined>()
  const { modules } = useModules()

  useEffect(() => {
    if (hasModules === undefined) {
      setHasModules(modules.length > 0)
    }
  }, [modules])

  return hasModules
}
