victorybiz / laravel-simple-select

Laravel Simple Select inputs component for Blade and Livewire.
MIT License
125 stars 18 forks source link

strange behavior duplicate items #8

Closed insulae closed 2 years ago

insulae commented 2 years ago

I am using laravel-simple-select on a Laravel9 with Jetstream and I don't know why the select show me duplicates items:

image

When i do a search:

image

My code:

  public function render()
    {

        $options = [
            ['id' => '1', 'name' => 'Item1'],
            ['id' => '2', 'name' => 'Item2'],
            ['id' => '3', 'name' => 'Item3']
          ];
        return view('livewire.producto-form',[
            'subcategorias' => $options,
            //'subcategorias' => Subcategoria::pluck('nombre','id')->ToArray(),
        ]);
    }

view:

                    <div class="col-span-6">
                        <x-jet-label for="producto.items" value="Item Name" />
                        <x-simple-select
                        name="Items"
                        id="item"
                        :options="$subcategorias"
                        value-field='id'
                        text-field='name'
                        placeholder="Select Item"
                        search-input-placeholder="Select Item"
                        :searchable="true"
                        class="form-select"
                    />
                        <x-jet-input-error for="producto.item" />
                    </div>
insulae commented 2 years ago

ok aparently was some cache or something like that, after a wile I tested again and worked.