Skip to content

fix(web): keep the vocabulary list when it failed to load - #15244

Merged
kodjima33 merged 2 commits into
BasedHardware:mainfrom
jitendravjh:fix/web-vocabulary-wipe
Sep 21, 2026
Merged

kodjima33 merged 2 commits into
BasedHardware:mainfrom
jitendravjh:fix/web-vocabulary-wipe

Conversation

@jitendravjh

@jitendravjh jitendravjh commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15243

getCustomVocabulary now returns null when the fetch fails instead of an empty list, and the settings page treats null as not loaded: the add button stays disabled and nothing is saved until the real list arrives.

Added src/components/settings/__tests__/SettingsVocabulary.test.tsx, fails on main (it saves just the new word) and passes now.

Failure-Class: none

Review in cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified against main — the fix is correct end to end, and it comes with the regression test the repo's Definition of Done asks for. Thanks!

  • web/app/src/lib/api.ts — getCustomVocabulary() now returns null on failure instead of [], and the doc comment spells out why (the save path replaces the whole list, so a failed load must not be readable as "empty"). Resolving the ambiguity at the API seam is the right shape for this fix. One nit: the old one-line docstring just above the new doc block is now redundant — feel free to merge them.
  • web/app/src/components/settings/SettingsPage.tsx — vocabulary state becomes string[] | null (initial null) and the load .catch(() => null) matches the new API contract. Both write paths (handleAddWord, handleRemoveWord) bail while the list is unknown, so a failed load can no longer be written back as the full list — that's the actual data-loss path from [Bounty proposal] fix(web): adding a vocabulary word can wipe the saved list ($25 proposed) #15243, closed on both ends. The add button is disabled while vocabulary === null, and the empty state is now three-way (loaded-empty / could-not-load / list), so the UI no longer presents a fetch failure as "no vocabulary". ProfileSection's prop type and words = vocabulary ?? [] rendering stay consistent with all of it.
  • web/app/src/components/settings/__tests__/SettingsVocabulary.test.tsx — real behavioral coverage through a controllable seam (mocked @/lib/api): rejected promise, null return, and the success path asserting the new word is saved alongside the loaded ones (['alpha', 'omi']). Follows the existing SettingsTrainingData.test.tsx conventions; CI on this head ran it in the web-app-checks lane with the full suite green.

Checks pass on this head; no auth, workflow, or dependency surfaces touched. Leaving for routine human maintainer merge review.

🤖 Automated review on behalf of the maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution web labels Sep 20, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Web fix: getCustomVocabulary now returns null on failed fetch instead of empty list, and settings page treats null as not-loaded (disables add, shows load-error message) instead of silently saving a truncated list. New component test covers load-failure, null-result, and success paths. CI green. Confidence 5/5.

@kodjima33
kodjima33 merged commit dc94df8 into BasedHardware:main Sep 21, 2026
30 checks passed
aryanorastar added a commit that referenced this pull request Sep 22, 2026
)

Fixes #15245

The settings page keeps the daily summary as not loaded when the fetch
fails, instead of falling back to on at 22:00, so the toggle stays
disabled and nothing is saved until the real settings arrive. Same shape
as the vocabulary list in #15244.

Added `src/components/settings/__tests__/SettingsDailySummary.test.tsx`,
fails on main (it saves hour 22) and passes now.

Failure-Class: none


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/15246?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty proposal] fix(web): adding a vocabulary word can wipe the saved list ($25 proposed)

3 participants