Skip to content

Commit

Permalink
fix(useRafFn): set initial delta to zero (#3150)
Browse files Browse the repository at this point in the history
  • Loading branch information
haykkh committed Jun 28, 2023
1 parent a4dfa5b commit cf6eb5f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/useRafFn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export function useRafFn(fn: (args: UseRafFnCallbackArguments) => void, options:
if (!isActive.value || !window)
return

const delta = timestamp - previousFrameTimestamp
const delta = timestamp - (previousFrameTimestamp || timestamp)

fn({ delta, timestamp })

previousFrameTimestamp = timestamp
Expand Down

0 comments on commit cf6eb5f

Please sign in to comment.