code review updates

Summary of what we fixed based on AI review feedback:

Formatting - Ran Prettier to fix code formatting
Redux state rollback - Moved Redux dispatch to after successful save in settingsHooks.js
Performance - Added caching layer in settingsModule (1-minute TTL) to prevent DB query on every status page request
Architecture - Inject settingsModule instead of raw AppSettings model for better encapsulation
This commit is contained in:
Craig Lawson committed 2026-01-11 20:51:25 +00:00
1 parent 7b619e6b31
commit 7556086f71
5 files changed
+47 -18

No files matched your search

+8
View File
@@ -56,6 +56,14 @@ const useSaveSettings = ({
setEmailPasswordHasBeenReset(false);
}
setSettingsData(settingsResponse.data.data);
// Update Redux state after successful save
if (typeof settings.showURL !== "undefined") {
const { setShowURL } = await import("../../Features/UI/uiSlice.js");
const { default: store } = await import("../../store.js");
store.dispatch(setShowURL(settings.showURL));
}
createToast({ body: t("settingsSuccessSaved") });
} catch (error) {
createToast({ body: t("settingsFailedToSave") });
-5
View File
@@ -168,11 +168,6 @@ const Settings = () => {
}
setSettingsData(newSettingsData);
// Update Redux immediately for UI feedback
if (name === "showURL") {
dispatch(setShowURL(value));
}
};
const handleSave = () => {