Issue
It looks like profiles may not correctly save the current Metric/Imperial selection.
If I switch to Metric, save a profile, and later reload it, the profile appears to come back as Imperial.
Suspected cause
This seems to happen because profile save snapshots localStorage, while the Settings dialog keeps unit changes in component state until the main Settings save/apply action is used.
So if a profile is saved before Settings are explicitly saved, the snapshot may still contain the previous unit config.
Relevant code
In SettingsPanel.jsx, unit changes are held in local state and only persisted when handleSave() runs.
The profile Save action calls saveProfile(...) directly.
In profiles.js, saveProfile() uses takeSnapshot(), and takeSnapshot() reads persisted values from localStorage.
That means profile save may capture the last saved config, not the current edited Settings values.
Reproduction
- Open Settings
- Change units from Imperial to Metric
- Save a profile without first saving/applying Settings
- Reload that profile
Units appear to revert to Imperial
Expected behavior
Saving a profile should include the current Settings values, including unit preferences.
Suggestion
Before taking a profile snapshot, either
- persist the current Settings state first, or
- pass the current in-memory config into saveProfile()
A UI warning or disabling profile save while Settings are unsaved could also help prevent confusion.
Issue
It looks like profiles may not correctly save the current Metric/Imperial selection.
If I switch to Metric, save a profile, and later reload it, the profile appears to come back as Imperial.
Suspected cause
This seems to happen because profile save snapshots localStorage, while the Settings dialog keeps unit changes in component state until the main Settings save/apply action is used.
So if a profile is saved before Settings are explicitly saved, the snapshot may still contain the previous unit config.
Relevant code
In SettingsPanel.jsx, unit changes are held in local state and only persisted when handleSave() runs.
The profile Save action calls saveProfile(...) directly.
In profiles.js, saveProfile() uses takeSnapshot(), and takeSnapshot() reads persisted values from localStorage.
That means profile save may capture the last saved config, not the current edited Settings values.
Reproduction
Units appear to revert to Imperial
Expected behavior
Saving a profile should include the current Settings values, including unit preferences.
Suggestion
Before taking a profile snapshot, either
A UI warning or disabling profile save while Settings are unsaved could also help prevent confusion.