From c212a837cd5b4938f93d5b95d28226b5d0e22cd0 Mon Sep 17 00:00:00 2001 From: Muhammad Eko Date: Tue, 1 Oct 2024 15:31:58 +0700 Subject: [PATCH] progress --- src/lib/hooks/dimension.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/hooks/dimension.ts b/src/lib/hooks/dimension.ts index 2d30b76..1713a78 100644 --- a/src/lib/hooks/dimension.ts +++ b/src/lib/hooks/dimension.ts @@ -1,4 +1,3 @@ -"use client" import { RefObject, useMemo, useSyncExternalStore } from "react" function subscribe(callback: (e: Event) => void) { @@ -15,6 +14,10 @@ function useDimensions(ref: RefObject) { width: ref.current?.offsetWidth ?? 0, height: ref.current?.offsetHeight ?? 0, }), + () => JSON.stringify({ + width: window.innerWidth, + height: window.innerHeight + }) ) return useMemo(() => JSON.parse(dimensions), [dimensions]) }