[GH-ISSUE #23472] Bug: Prompt Save button becomes unresponsive when onSubmit fails - loading state never resets #58660

Closed
opened 2026-05-05 23:39:34 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @limanto-com on GitHub (Apr 7, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23472

Bug Description

When editing a prompt and clicking the Save button in the Edit Modal, if the save operation fails (e.g., network error, server error), the button becomes permanently disabled and the modal stays open. The user receives no error feedback, and the loading spinner remains indefinitely.

Root Cause

In src/lib/components/workspace/Prompts/PromptEditor.svelte (lines 77-110), the submitHandler function has a bug:

  1. loading = true is set at the start
  2. await onSubmit() is called without error handling
  3. loading = false is only reached if onSubmit() succeeds
  4. If onSubmit() throws an error, loading stays true forever
  5. The Save button remains disabled with no error message shown to the user
// Current problematic code (lines 77-110):
const submitHandler = async () => {
    loading = true;  // ← Set to true

    if (validateCommandString(command)) {
        await onSubmit({...});  // ← No try-catch! If this throws, loading never resets
        showEditModal = false;
        // ... rest only executes on success
    }

    loading = false;  // ← Never reached if onSubmit throws
};

Steps to Reproduce

  1. Navigate to Workspace → Prompts → Edit a prompt
  2. Open browser DevTools → Network tab
  3. Click Edit button to open the modal
  4. Make some changes to the prompt content
  5. Disconnect network or block the API request (e.g., set to offline mode)
  6. Click Save
  7. Expected: Error toast appears, loading stops, can retry
  8. Actual: Button stays disabled with spinner, no error shown, modal stuck open

Suggested Fix

Wrap the onSubmit call in a try-catch block:

const submitHandler = async () => {
    if (disabled) {
        toast.error($i18n.t('You do not have permission to edit this prompt.'));
        return;
    }
    loading = true;

    if (validateCommandString(command)) {
        try {
            await onSubmit({
                id: prompt?.id,
                name,
                command,
                content,
                tags: tags.map((tag) => tag.name),
                access_grants: accessGrants,
                commit_message: commitMessage || undefined,
                is_production: isProduction
            });
            showEditModal = false;
            commitMessage = '';
            isProduction = true;
            await loadHistory(true);
            if (history.length > 0) {
                selectedHistoryEntry = history[0];
            }
        } catch (error) {
            toast.error(`${error}`);
        }
    } else {
        toast.error(
            $i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
        );
    }

    loading = false;
};

Environment

  • File: src/lib/components/workspace/Prompts/PromptEditor.svelte
  • Lines: 77-110
  • Component: PromptEditor.svelte → submitHandler function

Impact

This affects the user experience when:

  • Network connectivity issues occur
  • Server returns an error
  • Any unexpected error in the save process

Users are left with a frozen UI and no feedback about what went wrong.

Originally created by @limanto-com on GitHub (Apr 7, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/23472 ## Bug Description When editing a prompt and clicking the Save button in the Edit Modal, if the save operation fails (e.g., network error, server error), the button becomes permanently disabled and the modal stays open. The user receives no error feedback, and the loading spinner remains indefinitely. ## Root Cause In `src/lib/components/workspace/Prompts/PromptEditor.svelte` (lines 77-110), the `submitHandler` function has a bug: 1. `loading = true` is set at the start 2. `await onSubmit()` is called **without error handling** 3. `loading = false` is only reached if `onSubmit()` succeeds 4. If `onSubmit()` throws an error, `loading` stays `true` forever 5. The Save button remains disabled with no error message shown to the user ```svelte // Current problematic code (lines 77-110): const submitHandler = async () => { loading = true; // ← Set to true if (validateCommandString(command)) { await onSubmit({...}); // ← No try-catch! If this throws, loading never resets showEditModal = false; // ... rest only executes on success } loading = false; // ← Never reached if onSubmit throws }; ``` ## Steps to Reproduce 1. Navigate to Workspace → Prompts → Edit a prompt 2. Open browser DevTools → Network tab 3. Click Edit button to open the modal 4. Make some changes to the prompt content 5. Disconnect network or block the API request (e.g., set to offline mode) 6. Click Save 7. **Expected:** Error toast appears, loading stops, can retry 8. **Actual:** Button stays disabled with spinner, no error shown, modal stuck open ## Suggested Fix Wrap the `onSubmit` call in a try-catch block: ```svelte const submitHandler = async () => { if (disabled) { toast.error($i18n.t('You do not have permission to edit this prompt.')); return; } loading = true; if (validateCommandString(command)) { try { await onSubmit({ id: prompt?.id, name, command, content, tags: tags.map((tag) => tag.name), access_grants: accessGrants, commit_message: commitMessage || undefined, is_production: isProduction }); showEditModal = false; commitMessage = ''; isProduction = true; await loadHistory(true); if (history.length > 0) { selectedHistoryEntry = history[0]; } } catch (error) { toast.error(`${error}`); } } else { toast.error( $i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.') ); } loading = false; }; ``` ## Environment - **File:** `src/lib/components/workspace/Prompts/PromptEditor.svelte` - **Lines:** 77-110 - **Component:** PromptEditor.svelte → submitHandler function ## Impact This affects the user experience when: - Network connectivity issues occur - Server returns an error - Any unexpected error in the save process Users are left with a frozen UI and no feedback about what went wrong.
GiteaMirror added the bug label 2026-05-05 23:39:34 -05:00
Author
Owner

@dylanmorris1231ho-spec commented on GitHub (Apr 7, 2026):

Thanks for the detailed bug report and for including the root cause
analysis.

On Tue, Apr 7, 2026, 6:57 AM limanto-com @.***> wrote:

limanto-com created an issue (open-webui/open-webui#23472)
https://github.com/open-webui/open-webui/issues/23472
Bug Description

When editing a prompt and clicking the Save button in the Edit Modal, if
the save operation fails (e.g., network error, server error), the button
becomes permanently disabled and the modal stays open. The user receives no
error feedback, and the loading spinner remains indefinitely.
Root Cause

In src/lib/components/workspace/Prompts/PromptEditor.svelte (lines
77-110), the submitHandler function has a bug:

  1. loading = true is set at the start
  2. await onSubmit() is called without error handling
  3. loading = false is only reached if onSubmit() succeeds
  4. If onSubmit() throws an error, loading stays true forever
  5. The Save button remains disabled with no error message shown to the
    user

// Current problematic code (lines 77-110):
const submitHandler = async () => {
loading = true; // ← Set to true

if (validateCommandString(command)) {
    await onSubmit({...});  // ← No try-catch! If this throws, loading never resets
    showEditModal = false;
    // ... rest only executes on success
}

loading = false;  // ← Never reached if onSubmit throws

};

Steps to Reproduce

  1. Navigate to Workspace → Prompts → Edit a prompt
  2. Open browser DevTools → Network tab
  3. Click Edit button to open the modal
  4. Make some changes to the prompt content
  5. Disconnect network or block the API request (e.g., set to offline
    mode)
  6. Click Save
  7. Expected: Error toast appears, loading stops, can retry
  8. Actual: Button stays disabled with spinner, no error shown, modal
    stuck open

Suggested Fix

Wrap the onSubmit call in a try-catch block:

const submitHandler = async () => {
if (disabled) {
toast.error($i18n.t('You do not have permission to edit this prompt.'));
return;
}
loading = true;

if (validateCommandString(command)) {
    try {
        await onSubmit({
            id: prompt?.id,
            name,
            command,
            content,
            tags: tags.map((tag) => tag.name),
            access_grants: accessGrants,
            commit_message: commitMessage || undefined,
            is_production: isProduction
        });
        showEditModal = false;
        commitMessage = '';
        isProduction = true;
        await loadHistory(true);
        if (history.length > 0) {
            selectedHistoryEntry = history[0];
        }
    } catch (error) {
        toast.error(`${error}`);
    }
} else {
    toast.error(
        $i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.')
    );
}

loading = false;

};

Environment

  • File: src/lib/components/workspace/Prompts/PromptEditor.svelte
  • Lines: 77-110
  • Component: PromptEditor.svelte → submitHandler function

Impact

This affects the user experience when:

  • Network connectivity issues occur
  • Server returns an error
  • Any unexpected error in the save process

Users are left with a frozen UI and no feedback about what went wrong.


Reply to this email directly, view it on GitHub
https://github.com/open-webui/open-webui/issues/23472, or unsubscribe
https://github.com/notifications/unsubscribe-auth/B7VFZEEA5WFVGLFMLWMA2FT4UTULJAVCNFSM6AAAAACXPLKXE6VHI2DSMVQWIX3LMV43ASLTON2WKOZUGIYTONBYGM4DANI
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

<!-- gh-comment-id:4199482764 --> @dylanmorris1231ho-spec commented on GitHub (Apr 7, 2026): Thanks for the detailed bug report and for including the root cause analysis. On Tue, Apr 7, 2026, 6:57 AM limanto-com ***@***.***> wrote: > *limanto-com* created an issue (open-webui/open-webui#23472) > <https://github.com/open-webui/open-webui/issues/23472> > Bug Description > > When editing a prompt and clicking the Save button in the Edit Modal, if > the save operation fails (e.g., network error, server error), the button > becomes permanently disabled and the modal stays open. The user receives no > error feedback, and the loading spinner remains indefinitely. > Root Cause > > In src/lib/components/workspace/Prompts/PromptEditor.svelte (lines > 77-110), the submitHandler function has a bug: > > 1. loading = true is set at the start > 2. await onSubmit() is called *without error handling* > 3. loading = false is only reached if onSubmit() succeeds > 4. If onSubmit() throws an error, loading stays true forever > 5. The Save button remains disabled with no error message shown to the > user > > // Current problematic code (lines 77-110): > const submitHandler = async () => { > loading = true; // ← Set to true > > if (validateCommandString(command)) { > await onSubmit({...}); // ← No try-catch! If this throws, loading never resets > showEditModal = false; > // ... rest only executes on success > } > > loading = false; // ← Never reached if onSubmit throws > }; > > Steps to Reproduce > > 1. Navigate to Workspace → Prompts → Edit a prompt > 2. Open browser DevTools → Network tab > 3. Click Edit button to open the modal > 4. Make some changes to the prompt content > 5. Disconnect network or block the API request (e.g., set to offline > mode) > 6. Click Save > 7. *Expected:* Error toast appears, loading stops, can retry > 8. *Actual:* Button stays disabled with spinner, no error shown, modal > stuck open > > Suggested Fix > > Wrap the onSubmit call in a try-catch block: > > const submitHandler = async () => { > if (disabled) { > toast.error($i18n.t('You do not have permission to edit this prompt.')); > return; > } > loading = true; > > if (validateCommandString(command)) { > try { > await onSubmit({ > id: prompt?.id, > name, > command, > content, > tags: tags.map((tag) => tag.name), > access_grants: accessGrants, > commit_message: commitMessage || undefined, > is_production: isProduction > }); > showEditModal = false; > commitMessage = ''; > isProduction = true; > await loadHistory(true); > if (history.length > 0) { > selectedHistoryEntry = history[0]; > } > } catch (error) { > toast.error(`${error}`); > } > } else { > toast.error( > $i18n.t('Only alphanumeric characters and hyphens are allowed in the command string.') > ); > } > > loading = false; > }; > > Environment > > - *File:* src/lib/components/workspace/Prompts/PromptEditor.svelte > - *Lines:* 77-110 > - *Component:* PromptEditor.svelte → submitHandler function > > Impact > > This affects the user experience when: > > - Network connectivity issues occur > - Server returns an error > - Any unexpected error in the save process > > Users are left with a frozen UI and no feedback about what went wrong. > > — > Reply to this email directly, view it on GitHub > <https://github.com/open-webui/open-webui/issues/23472>, or unsubscribe > <https://github.com/notifications/unsubscribe-auth/B7VFZEEA5WFVGLFMLWMA2FT4UTULJAVCNFSM6AAAAACXPLKXE6VHI2DSMVQWIX3LMV43ASLTON2WKOZUGIYTONBYGM4DANI> > . > You are receiving this because you are subscribed to this thread.Message > ID: ***@***.***> >
Author
Owner

@Classic298 commented on GitHub (Apr 8, 2026):

@limanto-com can you please try latest dev?

<!-- gh-comment-id:4204633138 --> @Classic298 commented on GitHub (Apr 8, 2026): @limanto-com can you please try latest `dev`?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#58660