Skip to content

Commit

Permalink
fix(ssr): run animate on client only
Browse files Browse the repository at this point in the history
Close #328
  • Loading branch information
posva committed Mar 31, 2024
1 parent 0e582bd commit d76b02c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/useSpring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
onScopeDispose,
} from 'vue-demi'
import { SpringConfig, noWobble } from './presets'
import { raf, cancelRaf, now, isArray, stepper } from './utils'
import { raf, cancelRaf, now, isArray, stepper, isClient } from './utils'

const msPerFrame = 1000 / 60

Expand Down Expand Up @@ -97,8 +97,8 @@ export function useSpring<T extends MaybeRefOrGetter<SpringValue>>(
let idealValues = current[0]
let idealVelocities = current[1]

// only run this code on client
if (typeof window === 'undefined') {
// No need to compute or animate if we're not in the client
if (isClient) {
prevTime = now()
accumulatedTime = 0

Expand Down

0 comments on commit d76b02c

Please # to comment.