fix(tabsContext.tsx): change parameter type of newProject in uploadFlow function from optional boolean to required boolean to improve clarity and prevent potential bugs

fix(tabsContext.tsx): change parameter type of newProject in addFlow function from optional Boolean to required Boolean to improve clarity and prevent potential bugs
fix(extraSidebarComponent/index.tsx): change argument of uploadFlow function from undefined to false to fix a bug where uploadFlow was not being called correctly
fix(tabs/index.ts): change parameter type of newFlow in uploadFlow function from optional boolean to required boolean to improve clarity and prevent potential bugs
This commit is contained in:
anovazzi1 2023-09-21 10:08:12 -03:00
commit 577046523a
3 changed files with 4 additions and 4 deletions

View file

@ -316,7 +316,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
* The resulting JSON object is passed to the addFlow function.
*/
async function uploadFlow(
newProject?: boolean,
newProject: boolean,
file?: File
): Promise<String | undefined> {
let id;
@ -486,7 +486,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
}
const addFlow = async (
newProject?: Boolean,
newProject: Boolean,
flow?: FlowType
): Promise<String | undefined> => {
if (newProject) {

View file

@ -77,7 +77,7 @@ export default function ExtraSidebar(): JSX.Element {
<button
className="extra-side-bar-buttons"
onClick={() => {
uploadFlow();
uploadFlow(false);
}}
>
<IconComponent name="FileUp" className="side-bar-button-size " />

View file

@ -24,7 +24,7 @@ export type TabsContextType = {
uploadFlows: () => void;
isBuilt: boolean;
setIsBuilt: (state: boolean) => void;
uploadFlow: (newFlow?: boolean, file?: File) => Promise<String | undefined>;
uploadFlow: (newFlow: boolean, file?: File) => Promise<String | undefined>;
hardReset: () => void;
getNodeId: (nodeType: string) => string;
tabsState: TabsState;