Skip to content

Commit

Permalink
Merge pull request #4 from zweertsk/tweak/use-performance-now
Browse files Browse the repository at this point in the history
Use performance.now instead of Date.now
  • Loading branch information
abi authored Nov 16, 2023
2 parents 4a61f9e + 907e854 commit a776ce5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/hooks/useThrottle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function useThrottle(value: string, interval = 500) {
const lastUpdated = React.useRef<number | null>(null);

React.useEffect(() => {
const now = Date.now();
const now = performance.now();

if (!lastUpdated.current || now >= lastUpdated.current + interval) {
lastUpdated.current = now;
Expand Down

0 comments on commit a776ce5

Please sign in to comment.