What seems to be the problem:
Livewire\Exceptions\CorruptComponentPayloadException
Livewire encountered corrupt data when trying to hydrate the [roster] component. Ensure that the [name, id, data] of the Livewire component wasn’t tampered with between requests.
Steps to Reproduce:
a livewire change event to trigger the monthOptionChange method in its Livewire component class
Last Month
Current Month
Next Month
Are you using the latest version of Livewire:
“livewire/livewire”: “^2.3”,
Error seemed coming from
data population into these arrays:
$this->roster_rows
$this->roster_rowdays
Do you have any screenshots or code examples:
Roster.php :
<?php namespace App\Http\Livewire; use Livewire\Component; use Carbon\Carbon; use App\Helpers\Helper; use Log; class Roster extends Component { public $select_mthlastdate = 0; public $select_mth = null; public $roster_rows = array(); public $roster_rowdays = array(); public $seq = 0; public $monthOption = "0"; public $team_lead=""; public function __construct() { Log::info("__construct"); $this->select_mth = Carbon::now()->firstOfMonth(); } public function render() { $this->preloadData(); return view('livewire.roster'); } public function monthOptionChange() { $this->select_mth->addMonths($this->monthOption)->firstOfMonth(); $this->preloadData(); } public function preloadData() { $rs = Helper::getRosterInfo($this->select_mth); $this->roster_rows = array(); $this->roster_rowdays = array(); foreach ($rs as $rec) { $staff_no = $rec->staff_no; $shift_day = $rec->shift_day; if (!isset($this->roster_rows[$staff_no])) { $this->roster_rows[$staff_no] = array( 'shift_location' => $rec->shift_location, 'team_no' => $rec->team_no, 'team_lead' => $rec->team_lead, 'staff_no' => $rec->staff_no, 'staff_name' => $rec->staff_name, 'staff_asterisk' => $rec->staff_asterisk, ); } if (!isset($this->roster_rowdays[$staff_no])) { $this->roster_rowdays[$staff_no] = array(); } if (!isset($this->roster_rowdays[$staff_no][$shift_day])) { $this->roster_rowdays[$staff_no][$shift_day] = array( 'staff_no' => $rec->staff_no, 'shift_day' => $rec->shift_day, 'shift_class' => $rec->shift_class, 'shift_code' => $rec->shift_status, 'shift_status' => $rec->shift_status, ); } } $this->select_mthlastdate = $this->select_mth->copy()->endOfMonth()->day; } }