Skip to content

Commit 74a41e9

Browse files
Fix last selected column not displaying until next toggle
The displayColumns array was computed in booted() before Livewire hydrated the updated selectedColumns property, so it always reflected the previous state. Recompute displayColumns in updatedSelectedColumns() so the newly toggled column passes the in_array gate immediately. Also increase checkbox debounce from 500ms to 1000ms to better batch rapid column toggles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2a53993 commit 74a41e9

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

resources/views/report-editor.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class="m-4 block p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-g
1313
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6">
1414
@foreach($columns as $columnKey => $column)
1515
<div class="flex items-center mb-4">
16-
<input wire:model.live.debounce.500ms="selectedColumns" id="{{$column['key']}}" type="checkbox"
16+
<input wire:model.live.debounce.1000ms="selectedColumns" id="{{$column['key']}}" type="checkbox"
1717
value="{{ $column['key'] }}"
1818
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
1919
<label for="{{$column['key']}}"

src/Support/Concerns/WithReportBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ private function findElementByKey(array $array, $targetValue): ?array
4646
public function updatedSelectedColumns(): void
4747
{
4848
$this->resetPage();
49+
$this->displayColumns = $this->resolveColumns()->pluck('key')->toArray();
4950
}
5051

5152
public function availableColumns(): array

0 commit comments

Comments
 (0)