-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
feat(client): add debounce on page reload #13545
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Thanks for the PR @btea! |
}, time) | ||
} | ||
} | ||
const pageReload = debounceReload(50) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be just use lodash.debounce is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to avoid dependencies in client.ts
, we serve this file during dev to the browser.
How?
Don't know how to test it as there's no beta Vite package. I guess it‘s sufficient for my Mac. Maybe a little bit larger delay such as 80~100ms can cover more less performant machines. |
I'm a bit hesitant to add a longer timeout without proper testing for its need. About testing PRs, you can clone and build Vite and use an override in your app to the local Vite (if you use pnpm, it would be https://pnpm.io/package_json#pnpmoverrides for example). But I think this debounce makes sense, we could merge it, and you can test using the beta release soon. |
Description
close #13512
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).