Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 Platform bug squashing #1178

Merged
merged 11 commits into from
Aug 2, 2023
20 changes: 18 additions & 2 deletions next/src/pages/workflow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { type NextPage } from "next";
import Image from "next/image";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import { RiBuildingLine, RiStackFill } from "react-icons/ri";
import { RxHome, RxPlus } from "react-icons/rx";

Expand Down Expand Up @@ -71,6 +71,13 @@ const WorkflowPage: NextPage = () => {
);

const [open, setOpen] = useState(false);
const [disableBlockDialog, setDisableBlockDialog] = useState(true);

const onPaneClick = () => {
if (!disableBlockDialog) {
setOpen(true);
}
};

const changeQueryParams = async (newParams: Record<string, string>) => {
const updatedParams = {
Expand All @@ -89,6 +96,15 @@ const WorkflowPage: NextPage = () => {
const showLoader = !router.isReady || (isLoading && !!workflowId);
const showCreateForm = !workflowId && router.isReady;

useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should remove use effect

if (showCreateForm) {
setDisableBlockDialog(true);
}
else {
setDisableBlockDialog(false);
}
}, [showCreateForm]);

const onCreate = async (name: string) => {
const data = await WorkflowApi.fromSession(session).create({
name: name,
Expand Down Expand Up @@ -217,7 +233,7 @@ const WorkflowPage: NextPage = () => {
nodesModel={nodesModel}
edgesModel={edgesModel}
className="min-h-screen flex-1"
onPaneClick={() => setOpen(true)}
onPaneClick={onPaneClick}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to onPaneDoubleClick in a different commit, should be good to merge after fixing conflicts :)

/>
</>
);
Expand Down
Loading