diff --git a/client/components/file-dropdown/index.tsx b/client/components/file-dropdown/index.tsx index 31432551..4fab8762 100644 --- a/client/components/file-dropdown/index.tsx +++ b/client/components/file-dropdown/index.tsx @@ -25,14 +25,8 @@ const FileDropdown = ({ setExpanded(next) } - const onOpen = useCallback(() => { - setExpanded(true) - }, []) - - const onClose = useCallback(() => { - setExpanded(false) - // contentRef.current?.focus() - }, []) + const onOpen = () => setExpanded(true) + const onClose = useCallback(() => setExpanded(false), [setExpanded]) useEffect(() => { const newItems = files.map((file) => { @@ -52,25 +46,21 @@ const FileDropdown = ({ setItems(newItems) }, [files]) - const content = useCallback( - () => ( - - ), - [items, onClose] - ) + const content = + // a list of files with an icon and a title return ( diff --git a/client/components/new-post/index.tsx b/client/components/new-post/index.tsx index ccaa3211..a7f8349c 100644 --- a/client/components/new-post/index.tsx +++ b/client/components/new-post/index.tsx @@ -172,7 +172,7 @@ const Post = ({ } const submitPassword = useCallback( - (password) => onSubmit("protected", password), + (password: string) => onSubmit("protected", password), [onSubmit] ) diff --git a/client/next.config.mjs b/client/next.config.mjs index 06cf7ba9..c6346e5d 100644 --- a/client/next.config.mjs +++ b/client/next.config.mjs @@ -5,35 +5,36 @@ dotenv.config() /** @type {import('next').NextConfig} */ const nextConfig = { - reactStrictMode: true, - experimental: { - outputStandalone: true, - esmExternals: true - }, - webpack: (config, { dev, isServer }) => { - if (!dev && !isServer) { - Object.assign(config.resolve.alias, { - react: "preact/compat", - "react-dom/test-utils": "preact/test-utils", - "react-dom": "preact/compat" - }) - } - return config - }, - async rewrites() { - return [ - { - source: "/server-api/:path*", - destination: `${process.env.API_URL}/:path*` - }, - { - source: "/file/raw/:id", - destination: `/api/raw/:id` - } - ] - } + reactStrictMode: true, + experimental: { + outputStandalone: true, + esmExternals: true + }, + webpack: (config, { dev, isServer }) => { + if (!dev && !isServer) { + // TODO: enabling Preact causes the file switcher to hang the browser process + // Object.assign(config.resolve.alias, { + // react: "preact/compat", + // "react-dom/test-utils": "preact/test-utils", + // "react-dom": "preact/compat" + // }) + } + return config + }, + async rewrites() { + return [ + { + source: "/server-api/:path*", + destination: `${process.env.API_URL}/:path*` + }, + { + source: "/file/raw/:id", + destination: `/api/raw/:id` + } + ] + } } export default bundleAnalyzer({ enabled: process.env.ANALYZE === "true" })( - nextConfig + nextConfig ) diff --git a/client/package.json b/client/package.json index 373a4d1f..e57bb260 100644 --- a/client/package.json +++ b/client/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev --port 3001", "build": "next build", - "start": "next start", + "start": "next start --port 3001", "lint": "next lint && prettier --list-different --config .prettierrc '{components,lib,pages}/**/*.{ts,tsx}' --write", "analyze": "cross-env ANALYZE=true next build", "find:unused": "next-unused" @@ -27,7 +27,6 @@ "postcss-flexbugs-fixes": "^5.0.2", "postcss-hover-media-feature": "^1.0.2", "postcss-preset-env": "^7.4.3", - "preact": "^10.6.6", "prism-react-renderer": "^1.3.1", "react": "17.0.2", "react-datepicker": "^4.7.0", diff --git a/client/yarn.lock b/client/yarn.lock index b9317736..41397312 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -3524,11 +3524,6 @@ postcss@^8.1.7, postcss@^8.3.0, postcss@^8.4.12: picocolors "^1.0.0" source-map-js "^1.0.2" -preact@^10.6.6: - version "10.6.6" - resolved "https://registry.yarnpkg.com/preact/-/preact-10.6.6.tgz#f1899bc8dab7c0788b858481532cb3b5d764a520" - integrity sha512-dgxpTFV2vs4vizwKohYKkk7g7rmp1wOOcfd4Tz3IB3Wi+ivZzsn/SpeKJhRENSE+n8sUfsAl4S3HiCVT923ABw== - precinct@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/precinct/-/precinct-7.1.0.tgz#a0311e0b59029647eaf57c2d30b8efa9c85d129a"