mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[PR #14640] [MERGED] fix: Uncaught (in promise) TypeError: locales is undefined #110845
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/14640
Author: @silentoplayz
Created: 6/3/2025
Status: ✅ Merged
Merged: 6/4/2025
Merged by: @tjbck
Base:
dev← Head:locales-is-undefined-typeerror-fix📝 Commits (1)
86111adfix: Uncaught (in promise) TypeError: locales is undefined inCollapsible.svelte📊 Changes
1 file changed (+3 additions, -0 deletions)
View changed files
📝
src/lib/components/common/Collapsible.svelte(+3 -0)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Uncaught (in promise) TypeError: locales is undefinedthat could occur insrc/lib/components/common/Collapsible.svelte'sloadLocalefunction. This error happened when the$i18n.languagesvalue, passed aslocales, wasundefinedor not an array during initial component rendering or reactive updates. The fix adds a defensive check to ensurelocalesis a valid array before attempting to iterate over it, preventing the runtime error and improving component stability.Fixed
Uncaught (in promise) TypeError: locales is undefinedatCollapsible.svelte:16when$i18n.languagesisundefinedor not an array.Additional Information
i18nstore'slanguagesproperty might not be immediately available or fully populated.if (!locales || !Array.isArray(locales)) { return; }ensures that thefor...ofloop is only executed whenlocalesis a valid array, thus preventing theTypeError.loadLocalefunction now gracefully handles cases wherelocalesisnull,undefined, or not an array, returning early to prevent runtime errors.Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.