Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Option duplications when used within a sortable Repeater #41

Open
nocodelab opened this issue Nov 16, 2023 · 9 comments
Open

[Bug]: Option duplications when used within a sortable Repeater #41

nocodelab opened this issue Nov 16, 2023 · 9 comments
Labels
bug Something isn't working confirmed help wanted Extra attention is needed

Comments

@nocodelab
Copy link

What happened?

When the SelectTree field is used within a sortable Repeater a duplication behaviour happens.
Have a look at the video attached:

Screen.Recording.2023-11-16.at.11.20.50.mov

How to reproduce the bug

Simply use the SelectTree field in any repeater.

Package Version

3.1

PHP Version

8.2

Laravel Version

10

Which operating systems does with happen with?

No response

Notes

No response

@nocodelab nocodelab added the bug Something isn't working label Nov 16, 2023
@CodeWithDennis
Copy link
Owner

I checked with others, and it appears there's a bug in async Alpine. @nocodelab

this is a bug in async alpine. the PR was just merged and released. will update filament as soon as possible.

@nocodelab
Copy link
Author

I checked with others, and it appears there's a bug in async Alpine. @nocodelab

this is a bug in async alpine. the PR was just merged and released. will update filament as soon as possible.

that's great! thanks @CodeWithDennis!

@CodeWithDennis
Copy link
Owner

It looks like the issue isn't solved in the latest Filament release. I'll need to investigate more and might ask for assistance.

@CodeWithDennis CodeWithDennis added the help wanted Extra attention is needed label Dec 19, 2023
@nocodelab
Copy link
Author

Maybe it's related to the wire:key assignment.
I saw here https://github.com/CodeWithDennis/filament-select-tree/blob/3.x/resources/views/select-tree.blade.php that you are assigning a rand() value. How come? Maybe that breaks after the reorder...

@CodeWithDennis
Copy link
Owner

CodeWithDennis commented Dec 19, 2023

Maybe it's related to the wire:key assignment. I saw here https://github.com/CodeWithDennis/filament-select-tree/blob/3.x/resources/views/select-tree.blade.php that you are assigning a rand() value. How come? Maybe that breaks after the reorder...

Yes, this creates problems, but without it, the field won't be reactive/live. So, we have to find a better solution.

@ralphjsmit
Copy link

Why is the field not reactive/live without setting the wire:key to rand()?

@CodeWithDennis
Copy link
Owner

CodeWithDennis commented Dec 19, 2023

Why is the field not reactive/live without setting the wire:key to rand()?

Adding wire:key also makes the field flicker. So, we gotta figure out a better way to fix this. Without the wire:key the field won't be disabled.

(Removing the wire:key doesn't solve this issue BTW)

public static function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\TextInput::make('name')
               ->live(),
            SelectTree::make('categories')
                ->placeholder(__('Select categories'))
                ->label(__('Categories'))
                ->relationship('categories', 'name', 'parent_id')
                ->enableBranchNode()
                ->disabled(fn(Forms\Get $get) => filled($get('name'))),
        ])->columns(1);
}

@chandraauliatama
Copy link

@nocodelab any update on this one? did you fix your problem?

@nocodelab
Copy link
Author

nocodelab commented Apr 16, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants