fix: convert final $: reactive statement to $effect
Replace remaining $: if statement with $effect for slug generation in InlineComposerModal.
This commit is contained in:
parent
5b5785887d
commit
86b072c70f
1 changed files with 8 additions and 5 deletions
|
|
@ -103,9 +103,11 @@
|
||||||
.replace(/^-+|-+$/g, '')
|
.replace(/^-+|-+$/g, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if (essayTitle && !essaySlug) {
|
$effect(() => {
|
||||||
essaySlug = generateSlug(essayTitle)
|
if (essayTitle && !essaySlug) {
|
||||||
}
|
essaySlug = generateSlug(essayTitle)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
function handlePhotoUpload() {
|
function handlePhotoUpload() {
|
||||||
fileInput.click()
|
fileInput.click()
|
||||||
|
|
@ -231,10 +233,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: isOverLimit = characterCount > CHARACTER_LIMIT
|
const isOverLimit = $derived(characterCount > CHARACTER_LIMIT)
|
||||||
$: canSave =
|
const canSave = $derived(
|
||||||
(postType === 'post' && (characterCount > 0 || attachedPhotos.length > 0) && !isOverLimit) ||
|
(postType === 'post' && (characterCount > 0 || attachedPhotos.length > 0) && !isOverLimit) ||
|
||||||
(postType === 'essay' && essayTitle.length > 0 && content)
|
(postType === 'essay' && essayTitle.length > 0 && content)
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if mode === 'modal'}
|
{#if mode === 'modal'}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue