Fix wysiwyg component binding for better consistency#65
Conversation
| 'more_inside' => $this->purifierService->clean($dto->more_inside), | ||
| 'user_id' => $dto->user_id, | ||
| 'subsite_id' => $dto->subsite_id, | ||
| 'state' => $dto->state, |
There was a problem hiding this comment.
I don't know if I agree with not saving state in PostService. Looking at spots in the codebase where PostService stores a post from a PostDto, state is getting set to variously draft or to published in the dto and this would kind of thwart that setting.
I wonder if you got rid of state here because posts don't currently get published and this solves the problem? I noticed that in local and in current staging but thought the problem could be solved by adding state as a fillable property to app/Models/Post.php
There was a problem hiding this comment.
Oops! I took this out here because it was crashing to try to set this after some earlier changes in #62 that made state unfillable in the Post model and just applied a default setting of draft for that column.
The reason for the change in #62 was that the draft/published state is actually managed differently via the laravel-drafts trait, which uses the is_current and is_published flags to manage draft state, rather than using the state column, so the state column was never changing from draft even when a post was published. I should probably remove it from the PostDto too!
There was a problem hiding this comment.
OK! Thank you for the background info, that's fine then!
|
@wrose504 Hi, I had a go at reviewing this pull request! |
We initially made the WYSIWYG Livewire component using events to notify parent component of updated content.
While this appears to mostly work, updates appear to get missed here and there, leading to broken posts and comments. It's possible this is because the sequencing of events with respect to other component updates is not occurring as we expect. We also send events on every WYSIWYG change currently, leading to a lot of network traffic.
Livewire offers another mechanism for linking parent values to child component properties via
wire:model. This PR switches posting and commenting to use modelable properties, and to decrease the number of network calls by making most calls to$wire.setdisable live updates.