deepmodeling / deepmodeling/dpgui
[Code scan] Restore the saved language from storage instead of overwriting it
- Dominant language
- Vue
- Stars
- 9
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
This issue was found during a Codex global code scan of the repository.
Baseline commit: e3c5b38a99eb7ab778b5d8c68a5ed4ddf6cf91b3
Problem
The mounted hook calls the storage setter when it appears to intend to read the saved language.
Code references:
https://github.com/deepmodeling/dpgui/blob/e3c5b38a99eb7ab778b5d8c68a5ed4ddf6cf91b3/src/App.vue#L101-L103
https://github.com/deepmodeling/dpgui/blob/e3c5b38a99eb7ab778b5d8c68a5ed4ddf6cf91b3/src/App.vue#L208-L211
Relevant snippet:
```js
this.$i18n.locale =
this.$storage.setStorageSync("lang") || this.$i18n.locale;
```
Impact
A previously selected language is not restored on reload. Depending on the storage helper behavior, the call may also overwrite the saved `lang` value with an empty value.
Suggested fix
Use `getStorageSync("lang")` in `mounted()` and keep `setStorageSync("lang", value)` only in the language update handler.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.