Skip to content

Commit cf6eb5f

Browse files
authored
fix(useRafFn): set initial delta to zero (#3150)
1 parent a4dfa5b commit cf6eb5f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/core/useRafFn/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export function useRafFn(fn: (args: UseRafFnCallbackArguments) => void, options:
4646
if (!isActive.value || !window)
4747
return
4848

49-
const delta = timestamp - previousFrameTimestamp
49+
const delta = timestamp - (previousFrameTimestamp || timestamp)
50+
5051
fn({ delta, timestamp })
5152

5253
previousFrameTimestamp = timestamp

0 commit comments

Comments
 (0)