This commit is contained in:
Rizky 2024-08-24 17:47:38 +07:00
parent 88558f4472
commit 2e51328883
4 changed files with 7 additions and 6 deletions

View File

@ -164,7 +164,6 @@ const connect = (
} else {
return new Promise<void>((resolve, reject) => {
if (!conf.ws) {
let reconnect = 0;
const retry = () => {
const url = new URL(w.basehost || location.href);
url.pathname = "/sync";

BIN
bun.lockb

Binary file not shown.

View File

@ -19,10 +19,9 @@
"pkgs/*"
],
"dependencies": {
"@shikijs/core": "^1.12.1",
"brotli-wasm": "^3.0.1",
"fdir": "^6.1.0",
"fdir": "^6.2.0",
"react-select": "^5.8.0",
"typescript": "^5.2.2"
"typescript": "^5.5.4"
}
}

View File

@ -58,17 +58,20 @@ export const useLocal = <T extends object>(
} else {
local.lastRenderCount = 0;
}
local.lastRender = Date.now();
if (local.lastRenderCount > 300) {
clearTimeout(local.overRenderTimeout);
local.overRenderTimeout = setTimeout(() => {
local.lastRenderCount = 0;
local.lastRender = Date.now();
_render({});
}, 1000);
console.error("local.render more than 300 times in less than 300ms");
console.error(
`local.render executed ${local.lastRenderCount} times in less than 300ms`
);
return;
}