[PR #800] [MERGED] Fix: Submit button remains disabled after failed API calls #790

Closed
opened 2025-10-31 15:21:55 -05:00 by GiteaMirror · 0 comments
Owner

📋 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.3Head: fix/new-stack-create


📝 Commits (1)

  • 4bc0449 fix: 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) 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>
GiteaMirror added the pull-request label 2025-10-31 15:21:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#790