awcodes / filament-table-repeater

A modified version of the Filament Forms Repeater to display it as a table.
MIT License
188 stars 42 forks source link

TagsInput not working correctly #74

Closed victorhbbergamo closed 8 months ago

victorhbbergamo commented 8 months ago

Filament Version

v3

Plugin Version

v2.0.0

PHP Version

PHP 8.1.0

Problem description

"TagsInput" is not working correctly. Let's imagine the following scenario:

use Filament\Forms\Components;
use Awcodes\FilamentTableRepeater\Components\TableRepeater;

TableRepeater::make('preview')
  ->key('tablePreview')
  ->schema([
      Components\TagsInput::make('grid_line')->disabled(),
      Components\TagsInput::make('grid_columns'),
  ])
  ->default([]),

Basically, when adding new lines and adding tags, whenever you delete the first record, the next one becomes a duplicate, for example:

Before delete: image

After delete: image

I ended up deleting the "Preto" line, but he ended up duplicating everything.

Expected behavior

The expectation would be not to duplicate "Amarelo", 33 and 34. As in the example below:

Correct ✅ image

Wrong ❌ image

Steps to reproduce

Normally use "Tablet Repeater" together with "Tags Input".

use Filament\Forms\Form;
use Filament\Forms\Components;
use Awcodes\FilamentTableRepeater\Components\TableRepeater;

public static function form(Form $form): Form
{
  return $form
    ->schema([
      TableRepeater::make('preview')
        ->key('tablePreview')
        ->schema([
            Components\TagsInput::make('grid_line')->disabled(),
            Components\TagsInput::make('grid_columns'),
        ])
        ->default([]),
    ]);
}

Add two lines with any tags, then delete the first.

Reproduction repository

No response

Relevant log output

No response

awcodes commented 8 months ago

This is a bug in Filament Core.

https://github.com/filamentphp/filament/issues/7829