fix: Connect measurement unit preference to backend storage
Some checks failed
CI/CD Pipeline / Build Application (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled

Fixed measurement unit not persisting across page refreshes:

- Settings page now includes measurementUnit in the preferences object when saving
- MeasurementUnitSelector now accepts value/onChange props for controlled usage
- Settings state properly loads and saves measurementUnit from user preferences
- UnitInput component will now correctly read imperial/metric from user.preferences.measurementUnit

Previously, measurementUnit was only saved to localStorage but not synced to backend,
causing UnitInput to always default to metric since it reads from user.preferences.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 12:57:25 +00:00
parent d1490da4f0
commit 9d66b58f20
3 changed files with 23 additions and 7 deletions

View File

@@ -44,6 +44,9 @@ export function UnitInput({ type, value, onChange, ...textFieldProps }: UnitInpu
const measurementSystem: MeasurementSystem =
(user?.preferences?.measurementUnit as MeasurementSystem) || 'metric';
// Debug logging
console.log('[UnitInput] Measurement system:', measurementSystem, 'User preferences:', user?.preferences);
// Get the display unit symbol
const unitSymbol = getUnitSymbol(type, measurementSystem);