aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAjay <[email protected]>2023-12-22 00:23:36 -0500
committerAjay <[email protected]>2023-12-22 00:23:36 -0500
commit2865ea77fec808bcd1baec05ff0c7f355b0cc4de (patch)
tree2f8b857c97d7685e286b32e466626dfc101f50d9 /src
parenta8cd2357e70886f390525d989d06d9a5c563162d (diff)
downloadSponsorBlock-2865ea77fec808bcd1baec05ff0c7f355b0cc4de.tar.gz
SponsorBlock-2865ea77fec808bcd1baec05ff0c7f355b0cc4de.zip
Fix scrolling fast on edit time not saving properly
Diffstat (limited to 'src')
-rw-r--r--src/components/SponsorTimeEditComponent.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx
index 1b470a78..80b71f1c 100644
--- a/src/components/SponsorTimeEditComponent.tsx
+++ b/src/components/SponsorTimeEditComponent.tsx
@@ -593,11 +593,12 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
saveEditTimes(): void {
// Rate limit edits
const timeSinceLastEdit = Date.now() - this.lastEditTime;
- if (timeSinceLastEdit < 200) {
+ const rateLimitTime = 200;
+ if (timeSinceLastEdit < rateLimitTime) {
if (!this.editTimeTimeout) {
this.editTimeTimeout = setTimeout(() => {
this.saveEditTimes();
- }, timeSinceLastEdit)
+ }, rateLimitTime - timeSinceLastEdit)
}
return;