chore(flowManagerStore.ts): add isPending property to RFState to track pending state

chore(tabs/index.ts): keep existing properties and functions in FlowsContextType for future use
This commit is contained in:
anovazzi1 2024-01-04 18:51:32 -03:00
commit ca7193476d
2 changed files with 9 additions and 0 deletions

View file

@ -31,6 +31,7 @@ type RFState = {
lastCopiedSelection: { nodes: any; edges: any }; lastCopiedSelection: { nodes: any; edges: any };
nodeId: string; nodeId: string;
incrementNodeId: () => void; incrementNodeId: () => void;
isPending: boolean;
}; };
// this is our useStore hook that we can use in our components to get parts of the store and call actions // this is our useStore hook that we can use in our components to get parts of the store and call actions
@ -71,6 +72,7 @@ const useStore = create<RFState>((set, get) => ({
incrementNodeId: () => { incrementNodeId: () => {
set((state) => ({ nodeId: uid() })); set((state) => ({ nodeId: uid() }));
}, },
isPending: false,
})); }));
export default useStore; export default useStore;

View file

@ -5,14 +5,19 @@ import { FlowType, NodeDataType } from "../flow";
type OnChange<ChangesType> = (changes: ChangesType[]) => void; type OnChange<ChangesType> = (changes: ChangesType[]) => void;
export type FlowsContextType = { export type FlowsContextType = {
//keep
saveFlow: (flow?: FlowType, silent?: boolean) => Promise<void>; saveFlow: (flow?: FlowType, silent?: boolean) => Promise<void>;
tabId: string; tabId: string;
//keep
isLoading: boolean; isLoading: boolean;
setTabId: (index: string) => void; setTabId: (index: string) => void;
//keep
flows: Array<FlowType>; flows: Array<FlowType>;
deleteNode: (idx: string | Array<string>) => void; deleteNode: (idx: string | Array<string>) => void;
deleteEdge: (idx: string | Array<string>) => void; deleteEdge: (idx: string | Array<string>) => void;
//keep
removeFlow: (id: string) => void; removeFlow: (id: string) => void;
//keep
addFlow: ( addFlow: (
newProject: boolean, newProject: boolean,
flow?: FlowType, flow?: FlowType,
@ -25,7 +30,9 @@ export type FlowsContextType = {
flowName: string, flowName: string,
flowDescription?: string flowDescription?: string
) => void; ) => void;
//keep
downloadFlows: () => void; downloadFlows: () => void;
//keep
uploadFlows: () => void; uploadFlows: () => void;
isBuilt: boolean; isBuilt: boolean;
setIsBuilt: (state: boolean) => void; setIsBuilt: (state: boolean) => void;