#Entangle doesn't call hooks?
76 messages · Page 1 of 1 (latest)
Should work! Can you share your code?
sure!
Not using defer or anything?
Yep that’ll do it. Entangle makes use of it
this is AlpineJS components...why the defer there? Do I need it?
If it is on the wire:model it gets passed through to the alpine component
And it’s probably there to stop network requests when alpine opens the modal
hides 😂
so if I take the defer off it'll work, but what are the consequences?
Are you just refreshing the parent when the modal is saved? Can you dispatch an event then?
right now I have this in the parent
Every time the modal opens or closes a network request wil be fired
so I'd like to keep that in sync. If I don't have that if then there's a flash of the dialog
i'd rather NOT have that if, of course
Ah yep. So I don’t conditionally add the modal compnent, I always have it on the page and toggle show inside of it instead of keep in sync with parent
ya but then I got a flash of the modal
On page load? Use x-cloak
Haha nah that’s the best time to do it!
only works if there's a josh around
Why you coding in vacay? Fun personal project or work l?
Ah well that’s alright then 😁😁
so then to open it I need to send an event in or something?
how do you trigger the open from the parent?
same way I have it?
just remove the conditional?
Yeah I tend to use alpine, but I dispatch a browser event on edit click which has the item id as a parameter and just listen for that event in the modal component
right, in my case maybe two diff event, one for edit and one for new, but ya, that's nice
Yep that’s how I do it. create-item and edit-item
Haha yep! 😂
since you're here, one other question maybe...how do you handle making the modal readonly?
in my case these are past events, can't be edited
So like just a display modal instead of containing a form?
Probably two seperate compnents 😆
HECK W U JOSH
Haha 😂
(that's what I thought you'd say)
Or you could just disable inputs based on a condition or computed property. And also add validation in your save method it make sure it can be edited
I suppose I could update the components to take a readonly param
ha, there we go, same same
Yup!
again, I'M JOSH NOW
🥳
thanks again josh, you're so helpful
No worries! 🙂
I need to find a way to teach people this stuff, how to structure components, etc
creator series on laracasts?
a best practices course/site?
Yeah I should start writing on my blog again 😆 but yeah was thinking some kind of workshop
@warm crane I believe people would actually learn a thing or two from you 🙂
@worldly marlin I would like to point out ,regarding your modals, the package https://github.com/wire-elements/modal, they are solid
Thanks!
much nicer solution, thanks josh
Using the modal package? Personally I try to limit packages used but nothing wrong with it if it works for you 🙂
Thanks 😊
nope, doing it all my byself
...well the alpinejs component