79125957

Date: 2024-10-25 13:47:36
Score: 0.5
Natty:
Report link

Livewire renders the HTML on the server side. Initially, when the page loads, the CKEditor isn't displayed. However, when you open the modal, Livewire re-renders the Blade template, but the JavaScript isn't re-initialized.

This explains why removing the if statement resolves the issue: the initial server-side rendering triggers the JavaScript, and subsequent re-renders don't interfere with it.

To fix this, consider using Alpine.js to initialize your CKEditor instead of relying on your current JavaScript solution. Livewire will recognize the Alpine component within the newly rendered HTML and re-initialize Alpine.js accordingly.

FYI, i re wrote this answer using AI since english is not my main language

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Jasper Helmich