From 547afaa18faa1a1d298fde3553efb55efaf8208c Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Tue, 17 Mar 2026 23:50:04 +0100 Subject: [PATCH] remove dead code --- knip.json | 2 +- package.json | 1 - pnpm-lock.yaml | 12 -------- src/hooks/use-data-state.tsx | 52 -------------------------------- src/utils/get-strict-context.tsx | 23 -------------- 5 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 src/hooks/use-data-state.tsx delete mode 100644 src/utils/get-strict-context.tsx diff --git a/knip.json b/knip.json index 0de5de800..4cd9a4f15 100644 --- a/knip.json +++ b/knip.json @@ -1,6 +1,6 @@ { "$schema": "https://unpkg.com/knip@5/schema.json", - "entry": ["src/router.tsx"], + "entry": ["src/server.ts", "src/router.tsx"], "tailwind": { "entry": ["src/styles.css"] }, "project": ["src/**/*.{js,jsx,ts,tsx,mdx,css}"], "ignoreBinaries": ["mint"], diff --git a/package.json b/package.json index 0647573bc..a1d49bfd3 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,6 @@ "input-otp": "^1.4.2", "js-cookie": "^3.0.5", "jsonrepair": "^3.13.3", - "lucide-react": "^0.577.0", "monaco-editor": "^0.55.1", "motion": "^12.38.0", "nodemailer": "^8.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7e690b579..e10921440 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -198,9 +198,6 @@ importers: jsonrepair: specifier: ^3.13.3 version: 3.13.3 - lucide-react: - specifier: ^0.577.0 - version: 0.577.0(react@19.2.4) monaco-editor: specifier: ^0.55.1 version: 0.55.1 @@ -5660,11 +5657,6 @@ packages: resolution: {integrity: sha512-DqC6n3QQ77zdFpCMASA1a3Jlb64Hv2N2DciFGkO/4L9+q/IpIAuRlKOvCXabtRW6cQf8usbmM6BE/TOPysCdIA==} engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'} - lucide-react@0.577.0: - resolution: {integrity: sha512-4LjoFv2eEPwYDPg/CUdBJQSDfPyzXCRrVW1X7jrx/trgxnxkHFjnVZINbzvzxjN70dxychOfg+FTYwBiS3pQ5A==} - peerDependencies: - react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 - magic-string@0.25.9: resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} @@ -13391,10 +13383,6 @@ snapshots: lru.min@1.1.4: optional: true - lucide-react@0.577.0(react@19.2.4): - dependencies: - react: 19.2.4 - magic-string@0.25.9: dependencies: sourcemap-codec: 1.4.8 diff --git a/src/hooks/use-data-state.tsx b/src/hooks/use-data-state.tsx deleted file mode 100644 index dba6c05a3..000000000 --- a/src/hooks/use-data-state.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import * as React from "react"; - -type DataStateValue = string | boolean | null; - -function parseDatasetValue(value: string | null): DataStateValue { - if (value === null) return null; - if (value === "" || value === "true") return true; - if (value === "false") return false; - return value; -} - -function useDataState( - key: string, - forwardedRef?: React.Ref, - onChange?: (value: DataStateValue) => void, -): [DataStateValue, React.RefObject] { - const localRef = React.useRef(null); - React.useImperativeHandle(forwardedRef, () => localRef.current as T); - - const getSnapshot = (): DataStateValue => { - const el = localRef.current; - return el ? parseDatasetValue(el.getAttribute(`data-${key}`)) : null; - }; - - const subscribe = (callback: () => void) => { - const el = localRef.current; - if (!el) return () => {}; - const observer = new MutationObserver((records) => { - for (const record of records) { - if (record.attributeName === `data-${key}`) { - callback(); - break; - } - } - }); - observer.observe(el, { - attributes: true, - attributeFilter: [`data-${key}`], - }); - return () => observer.disconnect(); - }; - - const value = React.useSyncExternalStore(subscribe, getSnapshot); - - React.useEffect(() => { - if (onChange) onChange(value); - }, [value, onChange]); - - return [value, localRef]; -} - -export { useDataState }; diff --git a/src/utils/get-strict-context.tsx b/src/utils/get-strict-context.tsx deleted file mode 100644 index e0c827417..000000000 --- a/src/utils/get-strict-context.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import * as React from "react"; - -function getStrictContext( - name?: string, -): readonly [({ value, children }: { value: T; children?: React.ReactNode }) => React.JSX.Element, () => T] { - const Context = React.createContext(undefined); - - const Provider = ({ value, children }: { value: T; children?: React.ReactNode }) => ( - {children} - ); - - const useSafeContext = () => { - const ctx = React.useContext(Context); - if (ctx === undefined) { - throw new Error(`useContext must be used within ${name ?? "a Provider"}`); - } - return ctx; - }; - - return [Provider, useSafeContext] as const; -} - -export { getStrictContext };