Skip to content

armgit / ui

Public Imported from GitHub
0
TypeScript

Inline mounted hook in pdf block resizable shell

Andrew Luo403a6b2da45e
diff --git a/apps/v4/components/pdf-block-resizable-shell.tsx b/apps/v4/components/pdf-block-resizable-shell.tsx
index 016097c..4aff1b7 100644
--- a/apps/v4/components/pdf-block-resizable-shell.tsx
+++ b/apps/v4/components/pdf-block-resizable-shell.tsx
@@ -8,7 +8,6 @@ import {
} from "react-resizable-panels"
import { cn } from "@/lib/utils"
-import { useMounted } from "@/hooks/use-mounted"
import {
ResizableHandle,
ResizablePanel,
@@ -77,6 +76,16 @@ function useElementWidth<T extends HTMLElement>() {
return [setNode, width] as const
}
+function useMounted() {
+ const [mounted, setMounted] = React.useState(false)
+
+ React.useEffect(() => {
+ setMounted(true)
+ }, [])
+
+ return mounted
+}
+
function getSavedLayout(key: string) {
if (typeof window === "undefined") return null