defer-fixed

This commit is contained in:
Untone 2024-05-01 18:54:40 +03:00
parent e29188726c
commit 284c728b61
2 changed files with 14 additions and 14 deletions

View File

@ -1,4 +1,4 @@
// biome-ignore lint/style/useNodejsImportProtocol: // biome-ignore lint/style/useNodejsImportProtocol: it works like this
import { Buffer } from 'buffer' import { Buffer } from 'buffer'
import { clsx } from 'clsx' import { clsx } from 'clsx'

View File

@ -47,24 +47,24 @@ export const EditPage = () => {
onMount(() => { onMount(() => {
const shoutId = window.location.pathname.split('/').pop() const shoutId = window.location.pathname.split('/').pop()
const shoutIdFromUrl = Number.parseInt(shoutId ?? '0', 10) const shoutIdFromUrl = Number.parseInt(shoutId ?? '0', 10)
console.debug(`editing shout ${shoutIdFromUrl}`)
if (shoutIdFromUrl) setShoutId(shoutIdFromUrl) if (shoutIdFromUrl) setShoutId(shoutIdFromUrl)
}) })
createEffect( createEffect(
on( on([session, shout, shoutId], async ([ses, sh, shid]) => {
[session, shout, shoutId], console.debug(`editing session ${ses}`)
async ([ses, sh, shid]) => { console.debug(`editing shout_id ${shid}`)
if (ses?.user && !sh && shid) { console.debug(`editing shout ${sh}`)
const { shout: loadedShout, error } = await apiClient.getMyShout(shid) if (ses?.user && !sh && shid) {
if (error) { const { shout: loadedShout, error } = await apiClient.getMyShout(shid)
fail(error) if (error) {
} else { fail(error)
setShout(loadedShout) } else {
} setShout(loadedShout)
} }
}, }
{ defer: true }, }),
),
) )
const title = createMemo(() => { const title = createMemo(() => {