Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix user request cache

Steven85ed0202d8a6
diff --git a/web/src/store/v1/user.ts b/web/src/store/v1/user.ts
index ed98e3f2a..22aafe132 100644
--- a/web/src/store/v1/user.ts
+++ b/web/src/store/v1/user.ts
@@ -23,11 +23,13 @@ const useUserV1Store = create<UserV1Store>()((set, get) => ({
return await requestCache.get(username);
}
- const promise = userServiceClient.getUser({
- username: username,
- });
- requestCache.set(username, promise);
- const { user } = await promise;
+ const promisedUser = userServiceClient
+ .getUser({
+ username: username,
+ })
+ .then(({ user }) => user);
+ requestCache.set(username, promisedUser);
+ const user = await promisedUser;
if (!user) {
throw new Error("User not found");
}