When creating a new resource with a duplicate name, the API call fails but the submit button becomes permanently disabled. Even after updating the input field with a valid name, the button stays disabled because the dialog was closing on error, preventing proper state re-evaluation.
Root Cause
The original code called set(false) and setLoading(false) regardless of success/failure, causing the component to unmount before the enabled={!!name} prop could be re-evaluated.
Solution
Added proper error handling in NewLayout component:
Wrapped onConfirm() in try-catch block
Only close dialog on successful API calls
Keep dialog open on errors so users can retry
Always reset loading state in finally block
Impact
This fix applies to all resource creation flows that use the NewResource component, including Deployments, Stacks, Repos and Builds.
This ensures the button's enabled state is properly re-evaluated after failed operations across all resource types.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/moghtech/komodo/pull/800
**Author:** [@antoniosarro](https://github.com/antoniosarro)
**Created:** 9/2/2025
**Status:** ✅ Merged
**Merged:** 9/2/2025
**Merged by:** [@mbecker20](https://github.com/mbecker20)
**Base:** `1.19.3` ← **Head:** `fix/new-stack-create`
---
### 📝 Commits (1)
- [`4bc0449`](https://github.com/moghtech/komodo/commit/4bc04495579a6d3c8f58935f8e7d9b747fadd590) fix: inconsistent behaviour of new resource create button
### 📊 Changes
**1 file changed** (+9 additions, -3 deletions)
<details>
<summary>View changed files</summary>
📝 `frontend/src/components/layouts.tsx` (+9 -3)
</details>
### 📄 Description
Resolves #771
## Problem
When creating a new resource with a duplicate name, the API call fails but the submit button becomes permanently disabled. Even after updating the input field with a valid name, the button stays disabled because the dialog was closing on error, preventing proper state re-evaluation.
## Root Cause
The original code called `set(false)` and `setLoading(false)` regardless of success/failure, causing the component to unmount before the `enabled={!!name}` prop could be re-evaluated.
## Solution
Added proper error handling in `NewLayout` component:
- Wrapped `onConfirm()` in try-catch block
- Only close dialog on successful API calls
- Keep dialog open on errors so users can retry
- Always reset loading state in `finally` block
## Impact
This fix applies to all resource creation flows that use the `NewResource` component, including Deployments, Stacks, Repos and Builds.
This ensures the button's enabled state is properly re-evaluated after failed operations across all resource types.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/moghtech/komodo/pull/800
Author: @antoniosarro
Created: 9/2/2025
Status: ✅ Merged
Merged: 9/2/2025
Merged by: @mbecker20
Base:
1.19.3← Head:fix/new-stack-create📝 Commits (1)
4bc0449fix: inconsistent behaviour of new resource create button📊 Changes
1 file changed (+9 additions, -3 deletions)
View changed files
📝
frontend/src/components/layouts.tsx(+9 -3)📄 Description
Resolves #771
Problem
When creating a new resource with a duplicate name, the API call fails but the submit button becomes permanently disabled. Even after updating the input field with a valid name, the button stays disabled because the dialog was closing on error, preventing proper state re-evaluation.
Root Cause
The original code called
set(false)andsetLoading(false)regardless of success/failure, causing the component to unmount before theenabled={!!name}prop could be re-evaluated.Solution
Added proper error handling in
NewLayoutcomponent:onConfirm()in try-catch blockfinallyblockImpact
This fix applies to all resource creation flows that use the
NewResourcecomponent, including Deployments, Stacks, Repos and Builds.This ensures the button's enabled state is properly re-evaluated after failed operations across all resource types.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.