Livewire throws error when resetting a value in a component

What seems to be the problem: so i have a livewire component, called JobsIndex here is the code for it

<?php

namespace App\Http\Livewire;

use App\Models\Job;
use Livewire\Component;
use Livewire\WithPagination;

class JobsIndex extends Component
{
    use WithPagination;

    public $viewedJob;
    public $jobs;

    public function mount() {
        $this->jobs = $this->jobs->items();
    }

    public function viewJob($job) {
        $this->viewedJob = $job;
    }

    public function render()
    {
        return view('livewire.jobs-index');
    }
}

the initial render is ok, but one problem that im having is with

    public function viewJob($job) {
        $this->viewedJob = $job;
    }

this runs OK, but livewire keeps throwing errors that jobs is null, this is the image after the viewJob function was called

Thanks for your answer.

Hi,

What happens when you type hint $job

public function viewJob(Job $job) {
        $this->viewedJob = $job;
    }

The only problem is that it is not possible to pass an Object from JS. Workaround is to pass object ID and load it in the function.

my error is that, if i only call viewJob and dont do even anything, livewire still nullifies the jobs, i dont know what that is happening