Skip to content

Commit bca20c7

Browse files
committed
only fill user when data changes
1 parent 77c4e3f commit bca20c7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

frontend/src/ts/pages/leaderboards.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ async function requestData(update = false): Promise<void> {
193193
state.loading = false;
194194
state.updating = false;
195195
updateContent();
196+
if (!update && isAuthenticated()) {
197+
fillUser();
198+
}
196199
return;
197200
} else if (state.type === "weekly") {
198201
const data = await Ape.leaderboards.getWeeklyXp({
@@ -239,6 +242,9 @@ async function requestData(update = false): Promise<void> {
239242
state.loading = false;
240243
state.updating = false;
241244
updateContent();
245+
if (!update && isAuthenticated()) {
246+
fillUser();
247+
}
242248
return;
243249
} else {
244250
// state.updating = false;
@@ -742,10 +748,6 @@ function updateContent(): void {
742748

743749
updateJumpButtons();
744750
fillTable();
745-
if (isAuthenticated()) {
746-
//todo dont run this every time, only when new user data is fetched
747-
fillUser();
748-
}
749751
}
750752

751753
function updateTypeButtons(): void {

0 commit comments

Comments
 (0)