suspense-fix

This commit is contained in:
Untone 2024-05-01 20:40:40 +03:00
parent 4b1d21b15e
commit 18b7b22270
2 changed files with 12 additions and 8 deletions

View File

@ -1,6 +1,3 @@
// biome-ignore lint/style/useNodejsImportProtocol: it works like this
import { Buffer } from 'buffer'
import { clsx } from 'clsx'
import { Show } from 'solid-js'
@ -12,7 +9,12 @@ import { DropArea } from '../../_shared/DropArea'
import styles from './AudioUploader.module.scss'
window.Buffer = Buffer
try {
// biome-ignore lint/style/useNodejsImportProtocol: it works like this
window.Buffer = (await import('buffer')).Buffer
} catch (_e) {
window.Buffer = (await import('node:buffer')).Buffer
}
type Props = {
class?: string

View File

@ -1,4 +1,4 @@
import { Show, createEffect, createMemo, createSignal, lazy, on, onMount } from 'solid-js'
import { Show, Suspense, createEffect, createMemo, createSignal, lazy, on, onMount } from 'solid-js'
import { AuthGuard } from '../components/AuthGuard'
import { Loading } from '../components/_shared/Loading'
@ -74,9 +74,11 @@ export const EditPage = () => {
return (
<PageLayout title={title()}>
<AuthGuard>
<Show when={shout()} fallback={<Loading />}>
<EditView shout={shout() as Shout} />
</Show>
<Suspense fallback={<Loading />}>
<Show when={shout()} fallback={<Loading />}>
<EditView shout={shout() as Shout} />
</Show>
</Suspense>
</AuthGuard>
</PageLayout>
)