Skip to content

fix(preferences): normalize stored preference hydration#1051

Open
snkk2x-collab wants to merge 1 commit into
Stellar-Mail:mainfrom
snkk2x-collab:codex/preferences-normalize-971
Open

fix(preferences): normalize stored preference hydration#1051
snkk2x-collab wants to merge 1 commit into
Stellar-Mail:mainfrom
snkk2x-collab:codex/preferences-normalize-971

Conversation

@snkk2x-collab

Copy link
Copy Markdown

Summary

  • normalize stored UI preferences before hydration so partial or legacy records keep nested receipt defaults
  • validate enum-like preference fields and fall back to supported defaults for unsupported stored values
  • normalize stored layout preferences so invalid widths fall back to defaults and valid widths stay clamped
  • add regression coverage for partial UI records, unsupported UI values, and layout width restoration

Fixes #971

Before / After

Before, a partial stored receipts object could replace the default receipt policy object during hydration, and invalid stored layout width values could restore unpredictably. After this change, hydration produces a complete preference record with preserved defaults and bounded layout values.

Validation

  • pnpm exec vitest run src/features/preferences/preferences.test.ts
  • pnpm exec tsc --noEmit
  • pnpm exec eslint src/features/preferences/usePreferences.ts src/features/preferences/useLayoutPreferences.ts src/features/preferences/preferences.test.ts

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.

[Existing app][Preferences] Polish existing interaction states and copy

1 participant