langflow/src/frontend/src/CustomNodes/hooks/use-update-validation-status.tsx
cristhianzl b7ff822ae2 💡 (hooks): add TypeScript types to hook parameters for better type safety
💡 (index.tsx): add non-null assertion operator to playground variable
♻️ (use-on-file-drop.tsx): add type annotations for folderId and folderChangeCallback
♻️ (use-auto-resize-text-area.tsx): add type annotations for value and inputRef
♻️ (use-drag-and-drop.tsx): add type annotations for setIsDragging, setFiles, currentFlowId, and setErrorData
♻️ (use-focus-unlock.tsx): add type annotations for lockChat and inputRef
♻️ (use-upload.tsx): add type annotations for uploadFile, currentFlowId, setFiles, and lockChat
♻️ (use-column-defs.tsx): add type annotation for myData
♻️ (use-row-data.tsx): add type annotations for myData and open
♻️ (index.tsx): remove commented-out code
♻️ (use-filtered-flows.tsx): add type annotations for flowsFromFolder, searchFlowsComponents, and setAllFlows
💡 (index.tsx): add non-null assertion operator to flowsFromFolder variable
2024-06-25 20:02:15 -03:00

23 lines
711 B
TypeScript

import { useEffect } from "react";
import { FlowPoolType } from "../../types/zustand/flow";
const useUpdateValidationStatus = (
dataId: string,
flowPool: FlowPoolType,
setValidationStatus: (value: any) => void,
) => {
useEffect(() => {
const relevantData =
flowPool[dataId] && flowPool[dataId]?.length > 0
? flowPool[dataId][flowPool[dataId].length - 1]
: null;
if (relevantData) {
// Extract validation information from relevantData and update the validationStatus state
setValidationStatus(relevantData);
} else {
setValidationStatus(null);
}
}, [flowPool[dataId], dataId, setValidationStatus]);
};
export default useUpdateValidationStatus;