Skip to content

Commit

Permalink
fix: use useCallback for startStack
Browse files Browse the repository at this point in the history
  • Loading branch information
bodom0015 committed May 21, 2024
1 parent 65cd03c commit 992cfe4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/views/my-apps/MyApps.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect, useState} from 'react';
import React, {useCallback, useEffect, useState} from 'react';
import '../../index.css';
import Accordion from "react-bootstrap/Accordion";
import Button from "react-bootstrap/Button";
Expand Down Expand Up @@ -96,7 +96,7 @@ function MyAppsPage(props: any) {
}
}, [env?.analytics_tracking_id]);

const startStack = (stack: V1.Stack) => {
const startStack = useCallback((stack: V1.Stack) => {
const stackId = stack.id + "";
return V1.UserAppService.startStack(stackId)
.catch(reason => handleError("Failed to start stack", reason))
Expand All @@ -113,7 +113,7 @@ function MyAppsPage(props: any) {
console.log("Stack is now starting...");
refresh();
});
}
}, [env]);

useEffect(() => {
const transient = stacks.filter(stk => stk?.status?.endsWith('ing'));
Expand Down Expand Up @@ -170,7 +170,7 @@ function MyAppsPage(props: any) {
setQuickStartThread(timeout);
}
}
}, [autoRefresh, refreshInterval, stacks, stacks.length, quickstart, setQuickstart]);
}, [autoRefresh, refreshInterval, stacks, stacks.length, quickstart, setQuickstart, quickStartThread, specs, startStack]);

useEffect(() => {
if (!Object.keys(env).length) return;
Expand Down

0 comments on commit 992cfe4

Please sign in to comment.