fix: appearance not being saved

This commit is contained in:
varsnotwars 2025-08-08 15:33:54 +10:00
parent f4bdfa28a0
commit 6314f71e5e
1 changed files with 10 additions and 3 deletions

View File

@ -177,6 +177,8 @@ const userStore = (() => {
const fetchUserSettings = async () => {
if (!state.currentUser) {
console.error("No current user");
return;
}
@ -280,6 +282,10 @@ const userStore = (() => {
};
})();
// TODO: refactor initialUserStore as it has temporal coupling
// need to make it more clear that the order of the body is important
// or it leads to false positives
// See: https://github.com/usememos/memos/issues/4978
export const initialUserStore = async () => {
try {
const { user: currentUser } = await authServiceClient.getCurrentSession({});
@ -293,9 +299,6 @@ export const initialUserStore = async () => {
return;
}
// Fetch all user settings
await userStore.fetchUserSettings();
userStore.state.setPartial({
currentUser: currentUser.name,
userMapByName: {
@ -303,6 +306,10 @@ export const initialUserStore = async () => {
},
});
// must be called after user is set in store
await userStore.fetchUserSettings();
// must be run after fetchUserSettings is called.
// Apply general settings to workspace if available
const generalSetting = userStore.state.userGeneralSetting;
if (generalSetting) {