import { QueryLanguage } from "@contember/react-binding";
import { useEntityRedirectOnPersistSuccess } from "./useEntityRedirectOnPersistSuccess.js";
import { useMemo } from "react";
const useOnPersistSuccess = ({ redirectOnSuccess, onPersistSuccess }) => {
  const redirectOnSuccessCb = useEntityRedirectOnPersistSuccess(redirectOnSuccess);
  return useMemo(() => {
    if (!redirectOnSuccessCb || !onPersistSuccess) {
      return redirectOnSuccessCb ?? onPersistSuccess;
    }
    const listeners = QueryLanguage.desugarEventListener(onPersistSuccess);
    listeners.add(redirectOnSuccessCb);
    return listeners;
  }, [onPersistSuccess, redirectOnSuccessCb]);
};
export {
  useOnPersistSuccess
};
//# sourceMappingURL=useOnPersistSuccess.js.map
