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, '')
|
||||
}
|
||||
|
||||
$: if (essayTitle && !essaySlug) {
|
||||
$effect(() => {
|
||||
if (essayTitle && !essaySlug) {
|
||||
essaySlug = generateSlug(essayTitle)
|
||||
}
|
||||
})
|
||||
|
||||
function handlePhotoUpload() {
|
||||
fileInput.click()
|
||||
|
|
@ -231,10 +233,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
$: isOverLimit = characterCount > CHARACTER_LIMIT
|
||||
$: canSave =
|
||||
const isOverLimit = $derived(characterCount > CHARACTER_LIMIT)
|
||||
const canSave = $derived(
|
||||
(postType === 'post' && (characterCount > 0 || attachedPhotos.length > 0) && !isOverLimit) ||
|
||||
(postType === 'essay' && essayTitle.length > 0 && content)
|
||||
)
|
||||
</script>
|
||||
|
||||
{#if mode === 'modal'}
|
||||
|
|
|
|||
Loading…
Reference in a new issue