Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

544 B
Raw Blame
import { useMemo } from "react";

import { useGitSyncVisible } from "./use-git-sync-visible";
import { useRemoteSyncDirtyState } from "./use-remote-sync-dirty-state";

export function useHasGlossaryDirtyChanges(): boolean {
  const { isVisible: isGitSyncVisible } = useGitSyncVisible();
  const { dirty, isDirty } = useRemoteSyncDirtyState();

  return useMemo(() => {
    if (!isGitSyncVisible || !isDirty) {
      return false;
    }
    return dirty.some((entity) => entity.model === "glossary");
  }, [isGitSyncVisible, isDirty, dirty]);
}