Skip to content

Commit

Permalink
fix: broken bookmark button
Browse files Browse the repository at this point in the history
This must have been broken for a long time. This also fixes the issue when ticking checkboxes too quickly the state being reset. It required both making sure `small-bookmark-button.blade.php` was surrounded by an element completely, as well as adding wire:key to the inner row loop. Adding wire:key to the component itself doesn't work because the attributes aren't passed through...
  • Loading branch information
Roardom committed May 24, 2024
1 parent af49785 commit b5fccaa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion resources/views/components/torrent/row.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
data-category-id="{{ $torrent->category_id }}"
data-type-id="{{ $torrent->type_id }}"
data-resolution-id="{{ $torrent->resolution_id }}"
wire:key="torrent-search-row-{{ $torrent->id }}"
>
@if (auth()->user()->show_poster == 1)
<td class="torrent-search--list__poster">
Expand Down Expand Up @@ -141,7 +142,7 @@ class="torrent-search--list__edit form__standard-icon-button"
</a>
@endif

{{-- @livewire('small-bookmark-button', ['torrent' => $torrent, 'isBookmarked' => $torrent->bookmarks_exists, 'user' => auth()->user()], key('torrent-'.$torrent->id)) --}}
@livewire('small-bookmark-button', ['torrent' => $torrent, 'isBookmarked' => $torrent->bookmarks_exists, 'user' => auth()->user()], key('bookmark-torrent-'.$torrent->id))

@if (config('torrent.download_check_page'))
<a
Expand Down
20 changes: 10 additions & 10 deletions resources/views/livewire/small-bookmark-button.blade.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@if ($this->isBookmarked)
<button
<button
@if ($this->isBookmarked)
wire:click="destroy({{ $torrent->id }})"
class="form__standard-icon-button"
title="Unbookmark"
>
<i class="{{ config('other.font-awesome') }} fa-bookmark-slash"></i>
</button>
@else
<button
@else
wire:click="store({{ $torrent->id }})"
class="form__standard-icon-button"
title="Bookmark"
>
@endif
>
@if ($this->isBookmarked)
<i class="{{ config('other.font-awesome') }} fa-bookmark-slash"></i>
@else
<i class="{{ config('other.font-awesome') }} fa-bookmark"></i>
</button>
@endif
@endif
</button>

0 comments on commit b5fccaa

Please sign in to comment.