fix: postform crash

This commit is contained in:
Xylight committed 2024-11-01 10:32:06 -07:00
1 parent 2b27e99784
commit 3ebb46e37d
3 files changed
+17 -21

No files matched your search

@@ -52,7 +52,7 @@
nsfw: boolean nsfw: boolean
loading: boolean loading: boolean
alt_text?: string alt_text?: string
language_id?: number language_id?: number | string
} }
formtitle?: import('svelte').Snippet formtitle?: import('svelte').Snippet
} }
@@ -273,7 +273,7 @@
{#if !data.community} {#if !data.community}
<ObjectAutocomplete <ObjectAutocomplete
bind:q={communitySearch} bind:q={communitySearch}
bind:items={communities} items={communities}
jwt={$profile?.jwt} jwt={$profile?.jwt}
listing_type="All" listing_type="All"
label={$t('form.post.community')} label={$t('form.post.community')}
@@ -301,8 +301,8 @@
> >
{#snippet prefix()} {#snippet prefix()}
<Avatar <Avatar
url={data.community.icon} url={data?.community?.icon}
alt={data.community.name} alt={data.community?.name}
width={24} width={24}
/> />
{/snippet} {/snippet}
+1 -1
View File
@@ -53,7 +53,7 @@
id = generateID(), id = generateID(),
inlineAffixes = false, inlineAffixes = false,
shadow = 'none', shadow = 'none',
element = $bindable(undefined), element = $bindable(),
class: clazz = '', class: clazz = '',
customLabel, customLabel,
prefix, prefix,
+12 -16
View File
@@ -48,22 +48,6 @@
showSpinner: false, showSpinner: false,
}) })
let barTimeout: any = $state(0)
run(() => {
if (browser) {
if ($navigating) {
document.body.classList.toggle('wait', true)
barTimeout = setTimeout(() => nProgress.start(), 100)
}
if (!$navigating) {
document.body.classList.toggle('wait', false)
clearTimeout(barTimeout)
nProgress.done()
}
}
})
onMount(() => { onMount(() => {
if (browser) { if (browser) {
if (window.location.hash == 'main') { if (window.location.hash == 'main') {
@@ -81,6 +65,7 @@
}) })
if (browser) { if (browser) {
let barTimeout: number = $state(0)
$effect(() => { $effect(() => {
if (settings) { if (settings) {
document.body.classList.remove( document.body.classList.remove(
@@ -101,6 +86,17 @@
) )
} }
}) })
navigating.subscribe((value) => {
if (value) {
document.body.classList.toggle('wait', true)
barTimeout = setTimeout(() => nProgress.start(), 100)
} else {
document.body.classList.toggle('wait', false)
clearTimeout(barTimeout)
nProgress.done()
}
})
} }
</script> </script>