Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix initial deploy state

Tomas Valenta345ce7c86e47
diff --git a/components/Editor/Logs/DeployButton.tsx b/components/Editor/Logs/DeployButton.tsx
index 23f14e2f9..c139f5f70 100644
--- a/components/Editor/Logs/DeployButton.tsx
+++ b/components/Editor/Logs/DeployButton.tsx
@@ -17,6 +17,13 @@ interface DeploymentRepresentation {
}
function getDeploymentRepresentation(deployStatus: deployment_state | null | undefined, isInitializingDeploy: boolean | undefined): DeploymentRepresentation {
+ if (isInitializingDeploy) {
+ return {
+ text: 'Initializing...',
+ icon: <Spinner />,
+ }
+ }
+
switch (deployStatus) {
case deployment_state.generating:
return {
@@ -34,28 +41,14 @@ function getDeploymentRepresentation(deployStatus: deployment_state | null | und
icon: null,
}
case deployment_state.finished:
- if (isInitializingDeploy) {
- return {
- text: 'Deployed',
- icon: <Check size="16px" />
- }
- } else {
- return {
- text: 'Deploy',
- icon: null,
- }
+ return {
+ text: 'Deployed',
+ icon: <Check size="16px" />
}
default:
- if (isInitializingDeploy) {
- return {
- text: 'Initializing...',
- icon: <Spinner />,
- }
- } else {
- return {
- text: 'Deploy',
- icon: null,
- }
+ return {
+ text: 'Deploy',
+ icon: null,
}
}
}
diff --git a/components/Editor/index.tsx b/components/Editor/index.tsx
index 8c5b46c9e..93fa8f6e5 100644
--- a/components/Editor/index.tsx
+++ b/components/Editor/index.tsx
@@ -18,8 +18,8 @@ import Routes from './Routes'
// TODO: Prod API host
const apiHost = process.env.NODE_ENV === 'development'
- ? 'http://0.0.0.0:5000'
- : 'https://ai-api-service-7d2cl2hooq-uc.a.run.app'
+ ? 'https://ai-api-service-7d2cl2hooq-uc.a.run.app'
+ : 'http://0.0.0.0:5000'
export interface Props {
project: projects
@@ -78,6 +78,11 @@ function Editor({ project }: Props) {
const deployment = useLatestDeployment(project, selectedRoute)
const logs = deployment?.logs as Log[] | undefined
+ useEffect(function resetInitializing() {
+ if (!deployment) return
+ setIsInitializingDeploy(false)
+ }, [deployment])
+
const [focusedBlock, setFocusedBlock] = useState({ index: 0 })
const { trigger: generate } = useSWRMutation(`${apiHost}/generate`, handlePostGenerate)