Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: throttled action bad logic #34

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"website:dev": "npm run website:gendev && cd ./docs/ && web-dev-server --app-index ./index.html --node-resolve --open",
"document": "npm run document:gen && cd ./docs/ && web-dev-server --app-index ./index.html --node-resolve --open",
"document:dev": "npm run document:gendev && cd ./docs/ && web-dev-server --app-index ./index.html --node-resolve --open",
"document:gen": "node generatePackageMetadata.js && typedoc ./src/index.ts --disableSources --darkHighlightTheme solarized-dark --lightHighlightTheme solarized-dark --titleLink \"/modules.html\"",
"document:gen": "node generatePackageMetadata.js && typedoc ./src/index.ts --darkHighlightTheme solarized-dark --lightHighlightTheme solarized-dark --titleLink \"/modules.html\"",
"document:gendev": "node generatePackageMetadata.js && typedoc ./src/docs_index.ts --excludePrivate false --darkHighlightTheme solarized-dark --lightHighlightTheme solarized-dark --titleLink \"/modules.html\"",
"size": "size-limit",
"lint:ts": "eslint ./src/**/*.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/internals/utils/throttled_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export class ThrottledAction {
// Reset the state.
clearTimeout(this.timeout);
this.timeout = undefined;
this.shouldExecuteAfterDelay = false;
// After the delay, check if there was another trigger during the delay window.
if (this.shouldExecuteAfterDelay) {
this.trigger();
}
this.shouldExecuteAfterDelay = false;
}, this.delay);
}
}
Expand Down
Loading