[PR #23521] [CLOSED] fix: reset loading state in PromptEditor submitHandler on error #114544

Closed
opened 2026-05-18 15:19:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23521
Author: @funsaized
Created: 4/8/2026
Status: Closed

Base: devHead: fix/prompt-editor-clean


📝 Commits (1)

  • f624d71 fix: reset loading state in PromptEditor submitHandler on error

📊 Changes

1 file changed (+32 additions, -28 deletions)

View changed files

📝 src/lib/components/workspace/Prompts/PromptEditor.svelte (+32 -28)

📄 Description

Summary

Fixes https://github.com/open-webui/open-webui/issues/23472

The submitHandler in PromptEditor.svelte sets loading = true before calling await onSubmit(...), but if onSubmit throws (e.g., network error, server error), execution exits the function and loading = false is never reached. This leaves the Save button permanently disabled with no error feedback.

Changes

Wrapped the onSubmit call in try/catch/finally:

  • catch: Shows an error toast via toast.error(), matching the error handling pattern used throughout this file. Uses error instanceof Error ? error.message : $i18n.t('Failed to save prompt') to handle non-Error rejections cleanly.
  • finally: Ensures loading = false always executes, re-enabling the Save button regardless of outcome.

Before

If onSubmit() rejects, the Save button stays disabled forever with no error feedback.

After

On failure: error toast shown, spinner stops, Save button re-enabled so the user can retry.


Contributor License Agreement

By submitting my contributions to this repository in any form, I grant Open WebUI Inc. a perpetual, worldwide, irrevocable, royalty-free license, under copyright and patent, to use, modify, distribute, sublicense, and commercialize my work under any terms they choose, both now and in the future.

I represent that my contributions are my original work (or that I have sufficient rights to grant this license) and that I have the authority to enter into this agreement.

To the fullest extent permitted by law, my contributions are provided on an "as is" basis, with no warranties or guarantees of any kind, and I disclaim any liability for any issues or damages arising from their use or incorporation into the project, regardless of the type of legal claim.


🔄 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/open-webui/open-webui/pull/23521 **Author:** [@funsaized](https://github.com/funsaized) **Created:** 4/8/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/prompt-editor-clean` --- ### 📝 Commits (1) - [`f624d71`](https://github.com/open-webui/open-webui/commit/f624d71185de99d9b0db4d46bc385e267df70b17) fix: reset loading state in PromptEditor submitHandler on error ### 📊 Changes **1 file changed** (+32 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/workspace/Prompts/PromptEditor.svelte` (+32 -28) </details> ### 📄 Description ## Summary Fixes https://github.com/open-webui/open-webui/issues/23472 The `submitHandler` in `PromptEditor.svelte` sets `loading = true` before calling `await onSubmit(...)`, but if `onSubmit` throws (e.g., network error, server error), execution exits the function and `loading = false` is never reached. This leaves the Save button permanently disabled with no error feedback. ## Changes Wrapped the `onSubmit` call in `try/catch/finally`: - **`catch`**: Shows an error toast via `toast.error()`, matching the error handling pattern used throughout this file. Uses `error instanceof Error ? error.message : $i18n.t('Failed to save prompt')` to handle non-Error rejections cleanly. - **`finally`**: Ensures `loading = false` always executes, re-enabling the Save button regardless of outcome. ## Before If `onSubmit()` rejects, the Save button stays disabled forever with no error feedback. ## After On failure: error toast shown, spinner stops, Save button re-enabled so the user can retry. --- # Contributor License Agreement By submitting my contributions to this repository in any form, I grant Open WebUI Inc. a perpetual, worldwide, irrevocable, royalty-free license, under copyright and patent, to use, modify, distribute, sublicense, and commercialize my work under any terms they choose, both now and in the future. I represent that my contributions are my original work (or that I have sufficient rights to grant this license) and that I have the authority to enter into this agreement. **_To the fullest extent permitted by law, my contributions are provided on an "as is" basis, with no warranties or guarantees of any kind, and I disclaim any liability for any issues or damages arising from their use or incorporation into the project, regardless of the type of legal claim._** --- <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 2026-05-18 15:19:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#114544