Refactor: Remove isBuilt from zustand store

This commit is contained in:
igorrCarvalho 2024-01-23 18:45:01 -03:00
commit e90fdd00e7
3 changed files with 2 additions and 14 deletions

View file

@ -37,7 +37,6 @@ export default function ExtraSidebar(): JSX.Element {
const hasApiKey = useStoreStore((state) => state.hasApiKey);
const validApiKey = useStoreStore((state) => state.validApiKey);
const isBuilt = useFlowStore((state) => state.isBuilt);
const setErrorData = useAlertStore((state) => state.setErrorData);
const [dataFilter, setFilterData] = useState(data);
const [search, setSearch] = useState("");
@ -281,14 +280,13 @@ export default function ExtraSidebar(): JSX.Element {
{currentFlow && currentFlow.data && (
<ApiModal flow={currentFlow}>
<button
className={"w-full " + (!isBuilt ? "button-disable" : "")}
className={"w-full "}
>
<div className={classNames("extra-side-bar-buttons")}>
<IconComponent
name="Code2"
className={
"side-bar-button-size" +
(isBuilt ? " " : " extra-side-bar-save-disable")
"side-bar-button-size"
}
/>
</div>

View file

@ -36,7 +36,6 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
edges: [],
isBuilding: false,
isPending: false,
isBuilt: false,
reactFlowInstance: null,
lastCopiedSelection: null,
flowPool: {},
@ -66,16 +65,12 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
nodes,
edges,
flowState: undefined,
isBuilt: false,
});
get().reactFlowInstance!.setViewport(viewport);
},
setIsBuilding: (isBuilding) => {
set({ isBuilding });
},
setIsBuilt: (isBuilt) => {
set({ isBuilt });
},
setFlowState: (flowState) => {
const newFlowState =
typeof flowState === "function" ? flowState(get().flowState) : flowState;
@ -107,7 +102,6 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
edges: newEdges,
nodes: newChange,
flowState: undefined,
isBuilt: false,
});
const flowsManager = useFlowsManagerStore.getState();
@ -124,7 +118,6 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
set({
edges: newChange,
flowState: undefined,
isBuilt: false,
});
const flowsManager = useFlowsManagerStore.getState();
@ -286,7 +279,6 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
nodes: [],
edges: [],
flowState: undefined,
isBuilt: false,
getFilterEdge: [],
});
},

View file

@ -78,8 +78,6 @@ export type FlowStoreType = {
setLastCopiedSelection: (
newSelection: { nodes: any; edges: any } | null
) => void;
isBuilt: boolean;
setIsBuilt: (isBuilt: boolean) => void;
cleanFlow: () => void;
setFilterEdge: (newState) => void;
getFilterEdge: any[];