filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.09k stars 2.83k forks source link

repeater anonymous action not aware with current item state #9348

Closed atmonshi closed 10 months ago

atmonshi commented 11 months ago

Package

filament/filament

Package Version

v3.0.69

Laravel Version

10.26.2

Livewire Version

No response

PHP Version

v3.0.5

Problem description

adding anonymous action to a repeater and using fillForm the shop_product_id will always return the first item in the repaeater.

Actions::make([
    Actions\Action::make('more-options')
        ->label(function(Get $get){
            return 'show btn '.$get('shop_product_id');
        })
        ->fillForm(function (Get $get): array {
            return [
                'shop_product_id' => $get('shop_product_id'),
            ];
        })

        ->form([
            TextInput::make('shop_product_id')
        ]),
])

https://github.com/filamentphp/filament/assets/1952412/a167551f-eb47-44d5-a12a-7be6735d1160

Expected behavior

each action mapped to the current item in the repater and sho it's values when using $get

Steps to reproduce

clone the repo https://github.com/atmonshi/demo

it's a fork from the demo app

access the page shop/orders/2/edit notice the Order items and click the action show btn 9 a modal will open with the value 21 which is the first item in the repeater.

Reproduction repository

https://github.com/atmonshi/demo

Relevant log output

no errors or exceptions thrown
anselmpaul commented 10 months ago

I think this is a duplicate of #7454