fix some perf issues

This commit is contained in:
MathMan05
2026-02-07 17:02:28 -06:00
parent c9a1c291a8
commit 83ed0286d6
3 changed files with 18 additions and 1 deletions
+14 -1
View File
@@ -152,7 +152,9 @@ class InfiniteScroller {
},
{root, threshold: 0.1},
);
root.addEventListener("scroll", () => {
let time = Date.now();
const handleScroll = async () => {
await new Promise((res) => requestAnimationFrame(res));
if (this.scrollBottom < 5) {
const scroll = this.scroller;
if (!scroll) return;
@@ -161,6 +163,17 @@ class InfiniteScroller {
if (this.backElm.get(last) || !this.backElm.has(last)) return;
this.reachesBottom();
}
};
let last = 0;
root.addEventListener("scroll", async () => {
const now = Date.now();
const thisid = ++last;
if (now - time < 500) {
await new Promise((res) => setTimeout(res, 500));
if (thisid !== last) return;
}
time = now;
handleScroll();
});
}
+1
View File
@@ -681,6 +681,7 @@ class Localuser {
relationshipsUpdate = () => {};
rights: Rights;
updateRights(rights: string | number) {
if (this.rights.isSameAs(rights)) return;
this.rights.update(rights);
this.perminfo.user.rights = rights;
}
+3
View File
@@ -6,6 +6,9 @@ class Rights {
constructor(allow: string | number) {
this.update(allow);
}
isSameAs(allow: string | number) {
return this.allow === BigInt(allow);
}
update(allow: string | number) {
try {
this.allow = BigInt(allow);