Răsfoiți Sursa

don't use React.Dispatch<React.UseState<T>> type

Anukul Sangwan 4 ani în urmă
părinte
comite
933bdc2b9c

+ 3 - 1
dashboard/src/main/home/launch/launch-flow/SourcePage.tsx

@@ -28,7 +28,9 @@ type PropsType = RouteComponentProps & {
   setImageTag: (x: string) => void;
   setImageTag: (x: string) => void;
 
 
   actionConfig: ActionConfigType;
   actionConfig: ActionConfigType;
-  setActionConfig: React.Dispatch<React.SetStateAction<ActionConfigType>>;
+  setActionConfig: (
+    x: ActionConfigType | ((prevState: ActionConfigType) => ActionConfigType)
+  ) => void;
   procfileProcess: string;
   procfileProcess: string;
   setProcfileProcess: (x: string) => void;
   setProcfileProcess: (x: string) => void;
   branch: string;
   branch: string;

+ 3 - 3
dashboard/src/main/home/launch/launch-flow/WorkflowPage.tsx

@@ -1,5 +1,5 @@
 import React, { useContext, useEffect, useState } from "react";
 import React, { useContext, useEffect, useState } from "react";
-import { RouteComponentProps, withRouter } from "react-router";
+import { RouteComponentProps } from "react-router";
 import { FullActionConfigType } from "../../../../shared/types";
 import { FullActionConfigType } from "../../../../shared/types";
 import api from "../../../../shared/api";
 import api from "../../../../shared/api";
 import { Context } from "../../../../shared/Context";
 import { Context } from "../../../../shared/Context";
@@ -14,8 +14,8 @@ type PropsType = RouteComponentProps & {
   name: string;
   name: string;
   fullActionConfig: FullActionConfigType;
   fullActionConfig: FullActionConfigType;
   shouldCreateWorkflow: boolean;
   shouldCreateWorkflow: boolean;
-  setShouldCreateWorkflow: React.Dispatch<React.SetStateAction<boolean>>;
-  setPage: React.Dispatch<React.SetStateAction<string>>;
+  setShouldCreateWorkflow: (x: (prevState: boolean) => boolean) => void;
+  setPage: (x: string) => void;
 };
 };
 
 
 const WorkflowPage: React.FC<PropsType> = (props) => {
 const WorkflowPage: React.FC<PropsType> = (props) => {