mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-25 13:17:34 +08:00
fix save logic
This commit is contained in:
committed by
Gabriel Luiz Freitas Almeida
parent
c478b6135f
commit
bb79162843
@ -23,7 +23,7 @@ export default function FlowSettingsModal({
|
||||
|
||||
const [name, setName] = useState(currentFlow!.name);
|
||||
const [description, setDescription] = useState(currentFlow!.description);
|
||||
const [endpoint_name, setEndpointName] = useState(currentFlow!.endpoint_name);
|
||||
const [endpoint_name, setEndpointName] = useState(currentFlow!.endpoint_name??"");
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [disableSave, setDisableSave] = useState(true);
|
||||
function handleClick(): void {
|
||||
@ -31,7 +31,7 @@ export default function FlowSettingsModal({
|
||||
currentFlow!.name = name;
|
||||
currentFlow!.description = description;
|
||||
currentFlow!.endpoint_name =
|
||||
endpoint_name && endpoint_name.length > 0 ? endpoint_name : undefined;
|
||||
endpoint_name && endpoint_name.length > 0 ? endpoint_name : null;
|
||||
saveFlow(currentFlow!)
|
||||
?.then(() => {
|
||||
setOpen(false);
|
||||
@ -58,11 +58,10 @@ export default function FlowSettingsModal({
|
||||
}, [flows]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(disableSave);
|
||||
if (
|
||||
(!nameLists.includes(name) && currentFlow?.name !== name) ||
|
||||
currentFlow?.description !== description ||
|
||||
((currentFlow?.endpoint_name ?? "" !== endpoint_name) &&
|
||||
((currentFlow?.endpoint_name??"") !== endpoint_name &&
|
||||
isEndpointNameValid(endpoint_name ?? "", 50))
|
||||
) {
|
||||
setDisableSave(false);
|
||||
|
||||
@ -303,7 +303,7 @@ export type IconComponentProps = {
|
||||
export type InputProps = {
|
||||
name: string | null;
|
||||
description: string | null;
|
||||
endpointName?: string;
|
||||
endpointName?: string|null;
|
||||
maxLength?: number;
|
||||
setName?: (name: string) => void;
|
||||
setDescription?: (description: string) => void;
|
||||
|
||||
@ -7,7 +7,7 @@ export type FlowType = {
|
||||
id: string;
|
||||
data: ReactFlowJsonObject | null;
|
||||
description: string;
|
||||
endpoint_name?: string;
|
||||
endpoint_name?: string|null;
|
||||
style?: FlowStyleType;
|
||||
is_component?: boolean;
|
||||
last_tested_version?: string;
|
||||
|
||||
Reference in New Issue
Block a user