fix: convert final $: reactive statement to $effect

Replace remaining $: if statement with $effect for slug generation in InlineComposerModal.
This commit is contained in:
Justin Edmund 2025-11-04 19:49:07 -08:00
parent 5b5785887d
commit 86b072c70f

View file

@ -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'}