Skip to content

Commit 7ac1a24

Browse files
committed
Remove last checked time throttling from update check hook
- Modify use_update_check.ts to bypass the 5-minute cooldown and force a new network request to the GitHub API every time the hook becomes active. ├── apps │ └── editor │ └── src │ └── views │ └── prompt │ └── frontend │ ├── Home │ │ ├── Home.tsx │ │ └── hooks │ │ └── use-update-check.ts │ ├── Prompt.tsx │ └── i18n │ └── translations │ ├── home.ts │ └── index.ts └── packages └── ui └── src └── components └── editor └── prompt-view └── UpdateAvailable ├── UpdateAvailable.module.scss ├── UpdateAvailable.tsx └── index.ts
1 parent f9a185d commit 7ac1a24

1 file changed

Lines changed: 0 additions & 12 deletions

File tree

‎apps/editor/src/views/prompt/frontend/Home/hooks/use-update-check.ts‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ type UpdateInfo = {
77
}
88

99
let global_update_info: UpdateInfo = { is_available: false }
10-
let last_checked_time = 0
1110
const CHECK_INTERVAL = 5 * 60 * 1000
1211

1312
const is_newer = (latest: string, current: string) => {
@@ -33,17 +32,6 @@ export const use_update_check = (current_version: string, is_active: boolean) =>
3332
let timeout_id: ReturnType<typeof setTimeout>
3433

3534
const check = async () => {
36-
const now = Date.now()
37-
if (last_checked_time !== 0 && now - last_checked_time < CHECK_INTERVAL) {
38-
if (is_mounted) {
39-
set_update_info(global_update_info)
40-
timeout_id = setTimeout(check, CHECK_INTERVAL - (now - last_checked_time))
41-
}
42-
return
43-
}
44-
45-
last_checked_time = Date.now()
46-
4735
try {
4836
let page = 1
4937
while (page <= 10) {

0 commit comments

Comments
 (0)