client: remove preact to fix file dropdown process crash

This commit is contained in:
Max Leiter 2022-04-10 20:05:42 -07:00
parent 401a0df63b
commit 83def0ec86
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
5 changed files with 48 additions and 63 deletions

View file

@ -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,8 +46,7 @@ const FileDropdown = ({
setItems(newItems)
}, [files])
const content = useCallback(
() => (
const content =
<ul className={styles.content}>
{items.map((item) => (
<li key={item.id} onClick={onClose}>
@ -68,9 +61,6 @@ const FileDropdown = ({
</li>
))}
</ul>
),
[items, onClose]
)
// a list of files with an icon and a title
return (

View file

@ -172,7 +172,7 @@ const Post = ({
}
const submitPassword = useCallback(
(password) => onSubmit("protected", password),
(password: string) => onSubmit("protected", password),
[onSubmit]
)

View file

@ -12,11 +12,12 @@ const nextConfig = {
},
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"
})
// 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
},

View file

@ -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",

View file

@ -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"