🔧 fix(codeTabsComponent): remove unused useContext for isTweakPage in codeTabsComponent
🔧 fix(alertContext): remove isTweakPage and setIsTweakPage from alertContext 🔧 fix(genericModal): add null check for nodeClass before calling postValidatePrompt 🔧 fix(extraSidebarComponent): remove setIsTweakPage from extraSidebarComponent 🔧 fix(typesContext): remove isTweakPage and setIsTweakPage from typesContext
This commit is contained in:
parent
8a772086e2
commit
89a0918dc5
5 changed files with 12 additions and 21 deletions
|
|
@ -49,7 +49,6 @@ export default function CodeTabsComponent({
|
||||||
const [openAccordion, setOpenAccordion] = useState<string[]>([]);
|
const [openAccordion, setOpenAccordion] = useState<string[]>([]);
|
||||||
const { dark } = useContext(darkContext);
|
const { dark } = useContext(darkContext);
|
||||||
const { reactFlowInstance } = useContext(typesContext);
|
const { reactFlowInstance } = useContext(typesContext);
|
||||||
const { isTweakPage, setIsTweakPage } = useContext(alertContext);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (flow && flow["data"]!["nodes"]) {
|
if (flow && flow["data"]!["nodes"]) {
|
||||||
|
|
@ -58,16 +57,14 @@ export default function CodeTabsComponent({
|
||||||
}, [flow]);
|
}, [flow]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
unselectAllNodes({
|
if(tweaks){
|
||||||
data,
|
unselectAllNodes({
|
||||||
updateNodes: (nodes) => {
|
data,
|
||||||
reactFlowInstance?.setNodes(nodes);
|
updateNodes: (nodes) => {
|
||||||
},
|
reactFlowInstance?.setNodes(nodes);
|
||||||
});
|
},
|
||||||
|
});
|
||||||
return () => {
|
}
|
||||||
if (isTweakPage) setIsTweakPage(false);
|
|
||||||
};
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const copyToClipboard = () => {
|
const copyToClipboard = () => {
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,7 @@ const initialValue: alertContextType = {
|
||||||
notificationList: [],
|
notificationList: [],
|
||||||
pushNotificationList: () => {},
|
pushNotificationList: () => {},
|
||||||
clearNotificationList: () => {},
|
clearNotificationList: () => {},
|
||||||
removeFromNotificationList: () => {},
|
removeFromNotificationList: () => {}
|
||||||
isTweakPage: false,
|
|
||||||
setIsTweakPage: () => {},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const alertContext = createContext<alertContextType>(initialValue);
|
export const alertContext = createContext<alertContextType>(initialValue);
|
||||||
|
|
@ -123,8 +121,6 @@ export function AlertProvider({ children }: { children: ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<alertContext.Provider
|
<alertContext.Provider
|
||||||
value={{
|
value={{
|
||||||
isTweakPage,
|
|
||||||
setIsTweakPage,
|
|
||||||
removeFromNotificationList,
|
removeFromNotificationList,
|
||||||
clearNotificationList,
|
clearNotificationList,
|
||||||
notificationList,
|
notificationList,
|
||||||
|
|
|
||||||
|
|
@ -121,9 +121,10 @@ export default function GenericModal({
|
||||||
}
|
}
|
||||||
|
|
||||||
function validatePrompt(closeModal: boolean): void {
|
function validatePrompt(closeModal: boolean): void {
|
||||||
|
//nodeClass is always null on tweaks
|
||||||
postValidatePrompt(field_name, inputValue, nodeClass!)
|
postValidatePrompt(field_name, inputValue, nodeClass!)
|
||||||
.then((apiReturn) => {
|
.then((apiReturn) => {
|
||||||
if (apiReturn.data) {
|
if (apiReturn.data && nodeClass) {
|
||||||
let inputVariables = apiReturn.data.input_variables ?? [];
|
let inputVariables = apiReturn.data.input_variables ?? [];
|
||||||
if (inputVariables && inputVariables.length === 0) {
|
if (inputVariables && inputVariables.length === 0) {
|
||||||
setIsEdit(true);
|
setIsEdit(true);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export default function ExtraSidebar(): JSX.Element {
|
||||||
const { data, templates } = useContext(typesContext);
|
const { data, templates } = useContext(typesContext);
|
||||||
const { flows, tabId, uploadFlow, tabsState, saveFlow, isBuilt } =
|
const { flows, tabId, uploadFlow, tabsState, saveFlow, isBuilt } =
|
||||||
useContext(TabsContext);
|
useContext(TabsContext);
|
||||||
const { setSuccessData, setErrorData, setIsTweakPage } =
|
const { setSuccessData, setErrorData } =
|
||||||
useContext(alertContext);
|
useContext(alertContext);
|
||||||
const [dataFilter, setFilterData] = useState(data);
|
const [dataFilter, setFilterData] = useState(data);
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
|
|
@ -103,7 +103,6 @@ export default function ExtraSidebar(): JSX.Element {
|
||||||
<ApiModal flow={flow} disable={!isBuilt}>
|
<ApiModal flow={flow} disable={!isBuilt}>
|
||||||
<div
|
<div
|
||||||
className={classNames("extra-side-bar-buttons")}
|
className={classNames("extra-side-bar-buttons")}
|
||||||
onClick={() => setIsTweakPage(true)}
|
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Code2"
|
name="Code2"
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,6 @@ export type alertContextType = {
|
||||||
removeFromNotificationList: (index: string) => void;
|
removeFromNotificationList: (index: string) => void;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
setLoading: (newState: boolean) => void;
|
setLoading: (newState: boolean) => void;
|
||||||
isTweakPage: boolean;
|
|
||||||
setIsTweakPage: (newState: boolean) => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type darkContextType = {
|
export type darkContextType = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue