mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-27 20:22:37 +08:00
fix(exportModal/index.tsx): add missing import statement for typesContext to fix compilation error
feat(exportModal/index.tsx): modify downloadFlow function to pass an object with id, data, description, and name properties instead of directly passing flow object to improve code readability and maintainability
This commit is contained in:
@ -6,12 +6,14 @@ import { Checkbox } from "../../components/ui/checkbox";
|
||||
import { EXPORT_DIALOG_SUBTITLE } from "../../constants/constants";
|
||||
import { alertContext } from "../../contexts/alertContext";
|
||||
import { FlowsContext } from "../../contexts/flowsContext";
|
||||
import { typesContext } from "../../contexts/typesContext";
|
||||
import { removeApiKeys } from "../../utils/reactflowUtils";
|
||||
import BaseModal from "../baseModal";
|
||||
|
||||
const ExportModal = forwardRef(
|
||||
(props: { children: ReactNode }, ref): JSX.Element => {
|
||||
const { flows, tabId, downloadFlow } = useContext(FlowsContext);
|
||||
const { reactFlowInstance } = useContext(typesContext);
|
||||
const { setNoticeData } = useContext(alertContext);
|
||||
const [checked, setChecked] = useState(true);
|
||||
const flow = flows.find((f) => f.id === tabId);
|
||||
@ -66,7 +68,12 @@ const ExportModal = forwardRef(
|
||||
onClick={() => {
|
||||
if (checked) {
|
||||
downloadFlow(
|
||||
flows.find((flow) => flow.id === tabId)!,
|
||||
{
|
||||
id: tabId,
|
||||
data: reactFlowInstance?.toObject()!,
|
||||
description,
|
||||
name,
|
||||
},
|
||||
name!,
|
||||
description
|
||||
);
|
||||
@ -76,7 +83,12 @@ const ExportModal = forwardRef(
|
||||
});
|
||||
} else
|
||||
downloadFlow(
|
||||
removeApiKeys(flows.find((flow) => flow.id === tabId)!),
|
||||
removeApiKeys({
|
||||
id: tabId,
|
||||
data: reactFlowInstance?.toObject()!,
|
||||
description,
|
||||
name,
|
||||
}),
|
||||
name!,
|
||||
description
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user