mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-04 14:50:30 +08:00
### What problem does this PR solve? Feat: Add the iteration Node #4242 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
20 lines
529 B
TypeScript
20 lines
529 B
TypeScript
import { useFetchFlow } from '@/hooks/flow-hooks';
|
|
import { IGraph } from '@/interfaces/database/flow';
|
|
import { useEffect } from 'react';
|
|
import { useSetGraphInfo } from './use-set-graph';
|
|
|
|
export const useFetchDataOnMount = () => {
|
|
const { loading, data, refetch } = useFetchFlow();
|
|
const setGraphInfo = useSetGraphInfo();
|
|
|
|
useEffect(() => {
|
|
setGraphInfo(data?.dsl?.graph ?? ({} as IGraph));
|
|
}, [setGraphInfo, data]);
|
|
|
|
useEffect(() => {
|
|
refetch();
|
|
}, [refetch]);
|
|
|
|
return { loading, flowDetail: data };
|
|
};
|