Skip to content

Commit

Permalink
dont reset data if its the same as cached on 1st load
Browse files Browse the repository at this point in the history
  • Loading branch information
probablyjassin committed Nov 27, 2024
1 parent 99fadee commit 25a9011
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pages/dash/stundenplan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,21 @@ onMounted(async () => {
const response = await getCampusData('room');
data.value = response;
localData.value = data.value;
function arraysEqual(a, b) {
if (a === b) return true;
if (a == null || b == null) return false;
if (a.length !== b.length) return false;
for (var i = 0; i < a.length; ++i) {
if (JSON.stringify(a[i]) !== JSON.stringify(b[i])) return false;
}
return true;
}
if (!arraysEqual(JSON.parse(JSON.stringify(localData.value)), response)) {
data.value = response;
localData.value = data.value;
}
hasLoaded.value = true;
});
Expand Down

0 comments on commit 25a9011

Please sign in to comment.