import { useFileContext } from "./";
import { useMemo } from "react";
import { setIn } from "seamless-immutable";
export var useActiveDataset = function useActiveDataset() {
  var _useFileContext = useFileContext(),
      file = _useFileContext.file,
      setFile = _useFileContext.setFile;

  var result = useMemo(function () {
    return !file || !file.content ? null : {
      dataset: file.content,
      setDataset: function setDataset(newDataset) {
        setFile(setIn(file, ["content"], newDataset));
      }
    };
  }, [file, setFile]);
  return result || {};
};