Skip to content

fix(appstore): guard undefined store/category name labels - #274

Open
BetterAndBetterII wants to merge 1 commit into
IceWhaleTech:mainfrom
BetterAndBetterII:fix/appstore-undefined-name
Open

BetterAndBetterII wants to merge 1 commit into
IceWhaleTech:mainfrom
BetterAndBetterII:fix/appstore-undefined-name

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

Fixes IceWhaleTech/CasaOS#2537: when only a v2-schema third-party app store is registered, cateMenu can be empty so currentCate becomes undefined and AppPanel crashes on .name (TypeError: Cannot read properties of undefined (reading 'name')).

  • Keep a safe All sentinel when cateMenu is empty
  • Resolve category/author button labels and store queries through storeDisplayName (string name, localized name object via ice_i18n, or url / All fallback)

Test plan

  • Unit coverage in store_display_name.spec.js for undefined/null/missing name, string name, localized name object, and url fallback
  • Register only a v2 third-party store (e.g. big-bear-casaos), open App Store: grid should render without console TypeError
  • Category/author dropdowns still show labels and filter as before when the default store is present

Empty cateMenu (common with only a v2 third-party store) left
currentCate undefined, so reading .name crashed AppPanel. Resolve
labels through storeDisplayName with All/url fallbacks.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

inkly added a commit to ReCasaOS/CasaOS-UI that referenced this pull request Sep 4, 2026
…s empty

getCategoryList() dropped every category with a count of 0 and then took
menu[0] as the current selection. With only a third-party store registered
(no category-list.json, or category names that do not match its apps) the
backend answers a single "All" entry with count 0, the filter empties the
menu, and currentCate becomes undefined. The dropdown trigger reads
currentCate.name, so the render error stopped the whole App Store panel, and
getStoreList() threw on the same read so the app list never loaded either.

Guard the single writer instead of every reader: categoryMenu() filters the
list and falls back to a plain "All" selection when nothing is left, which
sends getStoreList() down its existing "All" branch and lists the whole
catalog.

Idea from IceWhaleTech/CasaOS-UI#274, tracked as IceWhaleTech/CasaOS#2537;
the PR's storeDisplayName helper guards readers we do not have and is not
ported.
@inkly

inkly commented Sep 4, 2026

Copy link
Copy Markdown

The bug is real and is fixed in the inkly distribution of CasaOS (UI v0.4.32, released in v0.4.41) — thanks for tracking it down.

Different route to it, for what it is worth: the guard sits at getCategoryList(), the single place that assigns currentCate, instead of at each reader. When the count filter empties the menu, the selection falls back to a plain "All" object, which sends the list request down the branch that returns the whole catalogue. That keeps the readers untouched and covers getStoreList(), which threw on the same undefined read before the template ever rendered.

If upstream never merges this, our dashboard is at https://github.com/inkly/CasaOS-UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] App Store grid fails to render (TypeError reading 'name') when only a v2-schema 3rd-party store is registered

2 participants