Skip to content

Commit 3bade83

Browse files
committed
Tweak return type of accounts-model load
Unnecessary ?
1 parent 4b8b3ae commit 3bade83

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/app/models/accounts-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function cached<T>(fn: () => T) {
1010
cachedResult = fn();
1111
valid = true;
1212
}
13-
return cachedResult;
13+
return cachedResult as T;
1414
};
1515

1616
cachedFn.invalidate = () => {

src/app/models/usermodel.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ const userModel = {
111111
};
112112

113113
const throttledLoginCheck = throttle((setData) => {
114-
accountsModel.load()?.then((oldUser) => {
114+
accountsModel.load().then((oldUser) => {
115115
accountsModel.load.invalidate();
116-
accountsModel.load()?.then((newUser) => {
116+
accountsModel.load().then((newUser) => {
117117
if (!isEqual(oldUser, newUser)) {
118-
userModel.load()?.then(setData);
118+
userModel.load().then(setData);
119119
}
120120
});
121121
});
@@ -128,7 +128,7 @@ function useUserModel() {
128128
const check = () => throttledLoginCheck(setData);
129129

130130
window.addEventListener('focus', check);
131-
userModel.load()?.then(setData);
131+
userModel.load().then(setData);
132132

133133
return () => window.removeEventListener('focus', check);
134134
}, []);

src/app/pages/details/common/track-link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {TrackedMouseEvent} from '~/components/shell/router-helpers/use-link
44

55
let userInfo: Partial<UserModelType>;
66

7-
userModel.load()?.then((i) => {
7+
userModel.load().then((i) => {
88
userInfo = i;
99
});
1010

0 commit comments

Comments
 (0)