[PR #22778] [CLOSED] fix: resolve ReferenceError in InputVariablesModal #42492

Closed
opened 2026-04-25 14:22:55 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22778
Author: @joaquinhuigomez
Created: 3/17/2026
Status: Closed

Base: mainHead: fix/input-variables-modal-reference-error


📝 Commits (1)

  • 30e2182 fix: resolve ReferenceError for idx in InputVariablesModal

📊 Changes

1 file changed (+18 additions, -18 deletions)

View changed files

📝 src/lib/components/chat/MessageInput/InputVariablesModal.svelte (+18 -18)

📄 Description

Summary

Fixes #22748

The InputVariablesModal throws ReferenceError: idx is not defined at runtime, causing the prompt variables modal to show an infinite loading spinner. The prompt variable feature is completely broken.

Root cause: The {@const} destructuring with rest syntax ({ type, ...variableAttributes }) inside an {#each} block triggers a scoping bug in Svelte 5's legacy compatibility mode, making the loop index variable idx undefined in the compiled output.

Fix:

  • Renamed the loop index from idx to variableIdx to avoid the naming collision
  • Replaced the rest destructuring {@const} with an explicit Object.fromEntries(Object.entries(...).filter(...)) to compute variableAttributes, sidestepping the Svelte 5 compilation issue

Test plan

  • Create a custom prompt with one or more template variables (e.g. Hello {{name}})
  • Type / in the chat input and select the custom prompt
  • Verify the "Input Variables" modal renders input fields (no infinite spinner)
  • Fill in variables and confirm they populate correctly
  • Test with typed variables (select, checkbox, number, etc.) to ensure variableAttributes spread still works

🤖 Generated with Claude Code


🔄 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/22778 **Author:** [@joaquinhuigomez](https://github.com/joaquinhuigomez) **Created:** 3/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/input-variables-modal-reference-error` --- ### 📝 Commits (1) - [`30e2182`](https://github.com/open-webui/open-webui/commit/30e21829e4f990e964d40549a41975ed3aaea545) fix: resolve ReferenceError for idx in InputVariablesModal ### 📊 Changes **1 file changed** (+18 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/chat/MessageInput/InputVariablesModal.svelte` (+18 -18) </details> ### 📄 Description ## Summary Fixes #22748 The `InputVariablesModal` throws `ReferenceError: idx is not defined` at runtime, causing the prompt variables modal to show an infinite loading spinner. The prompt variable feature is completely broken. **Root cause:** The `{@const}` destructuring with rest syntax (`{ type, ...variableAttributes }`) inside an `{#each}` block triggers a scoping bug in Svelte 5's legacy compatibility mode, making the loop index variable `idx` undefined in the compiled output. **Fix:** - Renamed the loop index from `idx` to `variableIdx` to avoid the naming collision - Replaced the rest destructuring `{@const}` with an explicit `Object.fromEntries(Object.entries(...).filter(...))` to compute `variableAttributes`, sidestepping the Svelte 5 compilation issue ## Test plan - [ ] Create a custom prompt with one or more template variables (e.g. `Hello {{name}}`) - [ ] Type `/` in the chat input and select the custom prompt - [ ] Verify the "Input Variables" modal renders input fields (no infinite spinner) - [ ] Fill in variables and confirm they populate correctly - [ ] Test with typed variables (select, checkbox, number, etc.) to ensure `variableAttributes` spread still works 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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-04-25 14:22: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/open-webui#42492