use-workflow-mode.ts 437 B

1234567891011121314
  1. import { useMemo } from 'react'
  2. import { useStore } from '../store'
  3. export const useWorkflowMode = () => {
  4. const historyWorkflowData = useStore(s => s.historyWorkflowData)
  5. const isRestoring = useStore(s => s.isRestoring)
  6. return useMemo(() => {
  7. return {
  8. normal: !historyWorkflowData && !isRestoring,
  9. restoring: isRestoring,
  10. viewHistory: !!historyWorkflowData,
  11. }
  12. }, [historyWorkflowData, isRestoring])
  13. }