Livewire support without `wire:model`
Closed this issue · 7 comments
To be honest I'm not sure if this is the right place, so feel free to close this issue if needed. A pointer where to post this would be appreciated if this is the wrong place :)
I'm using the $clipboard
in an app that I am still building. This uses Livewire for a lot of things. In this specific case I have a list of users with a button to create or edit users. This opens up a modal. When the user is saved it emits a signal for other components to pick up. In this case, I'm just refreshing the list of users, that contains a few $clipboard
's.
The $clipboard
's aren't refreshed.
I don't really want to wire things up as it's not supposed to be two-way data (the list does not contain inputs).
I hope someone here might know a solution
@ju5t Is the DOM not being updated at all?
@ryangjchandler it is, I verified with Ray too and added now()
to the list. When I remove the clipboard and just use standard blade to output the user's name for example, it refreshes as expected.
I'm pretty sure this is not related to $clipboard
right now as this code, doesn't refresh either:
<span x-data="{ value: '{{ $user->name }}' }">
<span x-html="value" />
</span>
$user
is inside the loop, by the way. It's too bad it doesn't work as this is a pretty useful thing for us. I'll ask at Livewire.
I'd maybe try a wire:key
as well.
I initially typed a lot more in my previous reply. TLDR-version; I tried wire:key
and using custom id's combined with {{ $loop>index }}
but that made no difference, unfortunately.
@ryangjchandler you know what's weird too? I just noticed that on a page with Livewire pagination, whenever we use the clipboard, Livewire for some reason struggles with diffing things. I don't think we had this problem with Alpine v2, but I can't remember - it's already too long ago :)
Essentially all data that is within a clipboard/Alpine component is stuck and won't get the correct data on page 2 and so on (we use Livewire pagination, we're not refreshing the page).
I'll try and work with @entangle
on those Livewire pages, I'm guessing that would work.
Yeah, this is a problem even without $clipboard
based on my own reproduction cases.
I've opened up livewire/livewire#3778 to continue this. I don't think this issue should stay open so I will close it.