Open MrMooky opened 2 years ago
When I add an onReady
event it works as expected. It's basically an exact copy of the onChange
.
onReady: () => {
this.instance.save().then((outputData) => {
this.$wire.set(dataProperty, outputData);
this.$wire.call('save');
}).catch((error) => {
console.log('Saving failed: ', error)
});
},
Hmm this behavior is actually really weird.
The Livewire component should have the initial data stored, so saving it without any changes should just emit that initial data.
On a side note, I'm planning a V2 of this package, which will require Alpine V3 so that it's possible to use the new "x-modelable" feature. So it will be way easier to incorporate changes of the data into the flow of alpine and Livewire.
While still playing around with this, I stumbled upon this weird behaviour: https://www.loom.com/share/d085d76e9caf422f8d365e407f3a44a0
Basically, when storing the content without making any changes, the content returns
null
. You can see that in the video when the placeholder "Are you ready? Then type here..." appears again after storing the content without changing it. When I change it, everything works as expected.