Skip to content

Commit

Permalink
use isClient to to test if it's CSR
Browse files Browse the repository at this point in the history
  • Loading branch information
rankjie authored Aug 26, 2024
1 parent 4a25bcd commit 6a7306a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/radix-vue/src/Toast/ToastRootImpl.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { isClient } from '@vueuse/shared'
import type { PrimitiveProps } from '@/Primitive'
import type { SwipeEvent } from './utils'
import { createContext, useForwardExpose } from '@/shared'
Expand Down Expand Up @@ -83,7 +84,7 @@ function startTimer(duration: number) {
// startTimer is used inside a watch with immediate set to true.
// This results in code execution during SSR.
// Ensure this code only runs in a browser environment
if (typeof window === 'undefined')
if (!isClient)
return
window.clearTimeout(closeTimerRef.value)
closeTimerStartTimeRef.value = new Date().getTime()
Expand Down

0 comments on commit 6a7306a

Please sign in to comment.