Uploading images in RichEditor on a custom page, triggers the component with the form to refresh
All code examples are attached as screenshots.
My situations is basically this:
I have a custom page which is a Kanban with multiple cards. On clicking a card, I open a modal with info about that card and a form inside.
The modal is a livewire component with an internal property
tarefa_id
(task_id) which is initialized as null
(this is important later), since there's no card clicked yet.
Clicking on a card, dispatches an event with a tarefa_id
so the modal may listen to it, load the info about the card based on it's ID, rebuild the modal (now it has data to build it correctly) and opens it. Inside the modal there's a form with a RichEditor field that allows images to be inserted on it. This is where the problem begins. Whenever I insert an image on the RichEditor, some requests are fired (I suppose they are uploading the image file, so that's fine) but suddenly the modal component rebuilds again. But for some reason, in this rebuilding, the component loses it's internal tarefa_id
value, reverting back to it's default value of null
. This causes the form and the entire modal to simply disappear, since now there's no id to gather info and build it correctly.
I could simply remove the ability to insert images on the RichEditor field and it works just fine, but we actually need images on this field, so I was hoping we could get some help here.
Code examples (all of these are on the modal component):
- RichEditor field definition
- Function that listen to the card click event
- mount function0 Replies