Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Loading Placeholder Bug - Breaking Table #1969

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions resources/views/components/includes/loading.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
@include($this->getLoadingPlaceHolderBlade(), ['colCount' => $colCount])
@else

<tr wire:key="{{ $tableName }}-loader" class="hidden d-none"
<tr wire:key="{{ $tableName }}-loader"
{{
$attributes->merge($customAttributes['loader-wrapper'])
->class(['w-full text-center h-screen place-items-center align-middle' => $isTailwind && ($customAttributes['loader-wrapper']['default'] ?? true)])
->class(['w-100 text-center h-100 align-items-center' => $isBootstrap && ($customAttributes['loader-wrapper']['default'] ?? true)]);
->class(['hidden w-full text-center h-screen place-items-center align-middle' => $isTailwind && ($customAttributes['loader-wrapper']['default'] ?? true)])
->class(['d-none w-100 text-center h-100 align-items-center' => $isBootstrap && ($customAttributes['loader-wrapper']['default'] ?? true)]);
}}
wire:loading.class.remove="hidden d-none"
>
<td colspan="{{ $colCount }}">
<td colspan="{{ $colCount }}" wire:key="{{ $tableName }}-loader-column" >
<div class="h-min self-center align-middle text-center">
<div class="lds-hourglass"
{{
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/table/tr.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
x-on:dragover.prevent.throttle.500ms="currentlyReorderingStatus && dragOverEvent(event)"
x-on:dragleave.prevent.throttle.500ms="currentlyReorderingStatus && dragLeaveEvent(event)"
@if($this->hasDisplayLoadingPlaceholder())
wire:loading.remove
wire:loading.class.add="hidden d-none"
@else
wire:loading.class.delay="opacity-50 dark:bg-gray-900 dark:opacity-60"
wire:loading.class.delay="opacity-50 dark:bg-gray-900 dark:opacity-60"
@endif
id="{{ $tableName }}-row-{{ $row->{$primaryKey} }}"
:draggable="currentlyReorderingStatus"
Expand Down
4 changes: 2 additions & 2 deletions tests/Traits/Visuals/LoadingPlaceholderVisualsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function test_can_see_placeholder_section(): void
{
Livewire::test(PetsTableLoadingPlaceholder::class)
->call('setPerPageAccepted', [1, 5, 10])
->assertSeeHtml('tr wire:key="table-loader" class="hidden d-none"')
->assertSeeHtml('tr wire:key="table-loader')
->call('setPerPage', 5);
}

Expand All @@ -21,7 +21,7 @@ public function test_can_see_placeholder_custom_text(): void
Livewire::test(PetsTableLoadingPlaceholder::class)
->call('setPerPageAccepted', [1, 5, 10])
->assertSeeHtmlInOrder([
'<tr wire:key="table-loader" class="hidden d-none"',
'<tr wire:key="table-loader"',
'<td colspan="',
'<div class="h-min self-center align-middle text-center"',
'<div class="lds-hourglass"',
Expand Down
Loading