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

View file

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

View file

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