Array reseted when i call function

What seems to be the problem:

Array rested when I call the function.

Code :

public $tranche_items = [];

    public function updatedQte($value,$index){
            $this->index = $index;
            $this->count_rows[$index] = $value;

            if($this->produit[0]->mode_vente_id === 1){
                $this->tranches_stock = StockPoidsPc::select()->where('produit_id', $this->produit_id)->where('tranche_id', $index)->limit($value)->get();
            }
            else if($this->produit[0]->mode_vente_id === 2){
                $this->tranches_stock = StockKgPc::select()->where('produit_id', $this->produit_id)->where('tranche_id', $index)->limit($value)->get();

            }

            foreach ($this->tranches_stock as $item){
                array_push($this->tranche_items, $item);
            }
    }

Steps to Reproduce:

Are you using the latest version of Livewire: Yes

Do you have any screenshots or code examples:

Try this in your foreach loop

$this->tranche_items[] = $item;

no problem in add item to array.
when i update the value of input “qte” call function updatedQte() and get new data from database.
i need to keep the old data of array and add to it new data from database .

note :
when call function updatedQte(), all variables and arrays are emptied in controller.
should be keep data, because i just call the function updatedQte(), not refresh all the page