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

Issue when removing items #58

Closed kennyhorna closed 11 months ago

kennyhorna commented 11 months ago

Filament Version

v3

Plugin Version

v2.0.2

PHP Version

PHP 8.2.4

Problem description

When you have multiple TableRepeaters component on the same form, it adds random elements to sibling repeaters.

See video.

I tried to use the ->key() method but the problem persisted.

Expected behavior

Items should be only added/removed to/from the repeater you are interacting with.

Steps to reproduce

use Awcodes\FilamentTableRepeater\Components\TableRepeater;
use Coolsam\FilamentFlatpickr\Forms\Components\Flatpickr;

// ...

Forms\Components\Tabs\Tab::make('Schedule')
    ->schema([
        TableRepeater::make('mondays')
            ->schema([
                Flatpickr::make('start'),
                Flatpickr::make('end'),

            ]),

        TableRepeater::make('tuesdays')
            ->schema([
                Flatpickr::make('start'),
                Flatpickr::make('end'),

            ]),

        TableRepeater::make('wednesdays')
            ->schema([
                Flatpickr::make('start'),
                Flatpickr::make('end'),

            ]),

        TableRepeater::make('thursdays')
            ->schema([
                Flatpickr::make('start'),
                Flatpickr::make('end'),

            ]),

        TableRepeater::make('fridays')
            ->schema([
                Flatpickr::make('start'),
                Flatpickr::make('end'),

            ]),

        TableRepeater::make('saturdays')
            ->schema([
                Flatpickr::make('start'),
                Flatpickr::make('end'),

            ]),

        TableRepeater::make('sundays')
            ->schema([
                Flatpickr::make('start'),
                Flatpickr::make('end'),

            ]),
    ])
    ->columns(3)
    ->columnSpanFull();

Reproduction repository

No response

Relevant log output

No response

awcodes commented 11 months ago

I can not replicate this. There was a bug in LW wire last week that I believe was merged in and fixed earlier this week. Please update Filament to the latest version and see if that fixes your issue.

kennyhorna commented 11 months ago

@awcodes I updated my libraries at the morning, before noticing this: Livewire: v3.0.0-beta.8 Filament: v3.0.13

I also tested it with the v2.0.3, but still, same issue.

awcodes commented 11 months ago

Can you try with regular inputs instead of Flatpicker. maybe it's causing the issue.

kennyhorna commented 11 months ago

@awcodes Indeed, it was the Flatpicker field. Also, I did eventually using a single repeater object, and just passing an array of default values for the whole week. Thanks.